diff --git a/lib/main.dart b/lib/main.dart index 6b403116..e5420b06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -65,8 +65,7 @@ class MyApp extends StatelessWidget { ChangeNotifierProxyProvider( create: (context) => ExercisesProvider(Provider.of(context, listen: false), []), - update: (context, auth, previous) => - previous ?? ExercisesProvider(auth, []), + update: (context, auth, previous) => previous ?? ExercisesProvider(auth, []), ), ChangeNotifierProxyProvider2( create: (context) => WorkoutPlansProvider( @@ -80,8 +79,7 @@ class MyApp extends StatelessWidget { ChangeNotifierProxyProvider( create: (context) => NutritionPlansProvider(Provider.of(context, listen: false), []), - update: (context, auth, previous) => - previous ?? NutritionPlansProvider(auth, []), + update: (context, auth, previous) => previous ?? NutritionPlansProvider(auth, []), ), ChangeNotifierProxyProvider( create: (context) => MeasurementProvider( @@ -92,14 +90,12 @@ class MyApp extends StatelessWidget { ChangeNotifierProxyProvider( create: (context) => BodyWeightProvider(Provider.of(context, listen: false), []), - update: (context, auth, previous) => - previous ?? BodyWeightProvider(auth, []), + update: (context, auth, previous) => previous ?? BodyWeightProvider(auth, []), ), ChangeNotifierProxyProvider( create: (context) => GalleryProvider(Provider.of(context, listen: false), []), - update: (context, auth, previous) => - previous ?? GalleryProvider(auth, []), + update: (context, auth, previous) => previous ?? GalleryProvider(auth, []), ), ], child: Consumer( diff --git a/lib/widgets/core/charts.dart b/lib/widgets/core/charts.dart index 2dd1c480..05396619 100644 --- a/lib/widgets/core/charts.dart +++ b/lib/widgets/core/charts.dart @@ -37,8 +37,7 @@ class MeasurementChartWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final unitTickFormatter = - charts.BasicNumericTickFormatterSpec((num? value) => '$value $unit'); + final unitTickFormatter = charts.BasicNumericTickFormatterSpec((num? value) => '$value $unit'); return charts.TimeSeriesChart( [ diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index e32f93aa..fb16d9bd 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -177,23 +177,26 @@ class _DashboardNutritionWidgetState extends State { }); }, ), - if (_hasContent) Container( - padding: EdgeInsets.only(left: 10), - child: Column( - children: [ - ...getContent(), - Container( - padding: EdgeInsets.all(15), - height: 180, - child: NutritionalPlanPieChartWidget(_plan!.nutritionalValues), - ) - ], - ), - ) else NothingFound( - AppLocalizations.of(context).noNutritionalPlans, - AppLocalizations.of(context).newNutritionalPlan, - PlanForm(), - ), + if (_hasContent) + Container( + padding: EdgeInsets.only(left: 10), + child: Column( + children: [ + ...getContent(), + Container( + padding: EdgeInsets.all(15), + height: 180, + child: NutritionalPlanPieChartWidget(_plan!.nutritionalValues), + ) + ], + ), + ) + else + NothingFound( + AppLocalizations.of(context).noNutritionalPlans, + AppLocalizations.of(context).newNutritionalPlan, + PlanForm(), + ), if (_hasContent) Row( mainAxisAlignment: MainAxisAlignment.end, @@ -253,31 +256,34 @@ class _DashboardWeightWidgetState extends State { ), Column( children: [ - if (weightEntriesData.items.isNotEmpty) Column( - children: [ - Container( - padding: EdgeInsets.all(15), - height: 180, - child: MeasurementChartWidget(weightEntriesData.items - .map((e) => MeasurementChartEntry(e.weight, e.date)) - .toList()), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - TextButton( - child: Text(AppLocalizations.of(context).goToDetailPage), - onPressed: () { - Navigator.of(context).pushNamed(WeightScreen.routeName); - }), - ], - ), - ], - ) else NothingFound( - AppLocalizations.of(context).noWeightEntries, - AppLocalizations.of(context).newEntry, - WeightForm(), + if (weightEntriesData.items.isNotEmpty) + Column( + children: [ + Container( + padding: EdgeInsets.all(15), + height: 180, + child: MeasurementChartWidget(weightEntriesData.items + .map((e) => MeasurementChartEntry(e.weight, e.date)) + .toList()), ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton( + child: Text(AppLocalizations.of(context).goToDetailPage), + onPressed: () { + Navigator.of(context).pushNamed(WeightScreen.routeName); + }), + ], + ), + ], + ) + else + NothingFound( + AppLocalizations.of(context).noWeightEntries, + AppLocalizations.of(context).newEntry, + WeightForm(), + ), ], ), ], @@ -406,18 +412,21 @@ class _DashboardWorkoutWidgetState extends State { }); }, ), - if (_hasContent) Container( - padding: EdgeInsets.only(left: 10), - child: Column( - children: [ - ...getContent(), - ], - ), - ) else NothingFound( - AppLocalizations.of(context).noWorkoutPlans, - AppLocalizations.of(context).newWorkout, - WorkoutForm(WorkoutPlan.empty()), - ), + if (_hasContent) + Container( + padding: EdgeInsets.only(left: 10), + child: Column( + children: [ + ...getContent(), + ], + ), + ) + else + NothingFound( + AppLocalizations.of(context).noWorkoutPlans, + AppLocalizations.of(context).newWorkout, + WorkoutForm(WorkoutPlan.empty()), + ), if (_hasContent) Row( mainAxisAlignment: MainAxisAlignment.end, diff --git a/test/weight_model_test.dart b/test/weight_model_test.dart index 14bcfb01..1a3698f8 100644 --- a/test/weight_model_test.dart +++ b/test/weight_model_test.dart @@ -30,7 +30,8 @@ void main() { }); test('Test that the weight entries are correctly converted from json', () async { - final WeightEntry weightEntryObj = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31)); + final WeightEntry weightEntryObj = + WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31)); final WeightEntry weightEntry = WeightEntry.fromJson({ 'id': 1, 'weight': '80',