diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7516402c..461eaeb3 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -183,6 +183,8 @@ "@addMeal": {}, "mealLogged": "Meal logged to diary", "@mealLogged": {}, + "logMeal": "Log this meal", + "@logMeal": {}, "addIngredient": "Add ingredient", "@addIngredient": {}, "nutritionalPlan": "Nutritional plan", diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index e8a3ef89..9cc1780c 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -60,9 +60,39 @@ class _DashboardNutritionWidgetState extends State { List out = []; if (hasContent) { for (var meal in plan.meals) { - out.add(Text( - meal.time.format(context), - style: TextStyle(fontWeight: FontWeight.bold), + out.add(Container( + width: double.infinity, + child: Row( + children: [ + Spacer( + flex: 1, + ), + Expanded( + flex: 8, + child: Text( + meal.time.format(context), + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), + ), + Flexible( + child: IconButton( + icon: Icon(Icons.bar_chart), + onPressed: () { + Provider.of(context, listen: false).logMealToDiary(meal); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context)!.mealLogged, + textAlign: TextAlign.center, + ), + ), + ); + }, + ), + ) + ], + ), )); out.add(Row( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -250,16 +280,33 @@ class _DashboardWorkoutWidgetState extends State { List out = []; if (hasContent) { for (var day in _workoutPlan.days) { - out.add(Text( - day.description, - style: TextStyle(fontWeight: FontWeight.bold), - )); - out.add(IconButton( - icon: Icon(Icons.play_arrow), - onPressed: () { - Navigator.of(context).pushNamed(GymModeScreen.routeName, arguments: day); - }, + out.add(Container( + width: double.infinity, + child: Row( + children: [ + Spacer( + flex: 1, + ), + Expanded( + flex: 8, + child: Text( + day.description, + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), + ), + Flexible( + child: IconButton( + icon: Icon(Icons.play_arrow), + onPressed: () { + Navigator.of(context).pushNamed(GymModeScreen.routeName, arguments: day); + }, + ), + ) + ], + ), )); + if (showDetail) { day.sets.forEach((set) { out.add(Column( @@ -269,14 +316,14 @@ class _DashboardWorkoutWidgetState extends State { children: [ Text(s.exerciseObj.name), Text(s.repsText), - SizedBox(height: 5), ], ); }).toList(), - SizedBox(height: 15), ], )); }); + out.add(SizedBox(height: 10)); + out.add(Divider()); } } } diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 55e56c37..4f611962 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -227,7 +227,7 @@ class DismissibleMealHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - 'Log this meal', + AppLocalizations.of(context)!.logMeal, style: TextStyle(color: Colors.white), ), Icon(