mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Move the action buttons in the dashboard to the side
This commit is contained in:
@@ -183,6 +183,8 @@
|
||||
"@addMeal": {},
|
||||
"mealLogged": "Meal logged to diary",
|
||||
"@mealLogged": {},
|
||||
"logMeal": "Log this meal",
|
||||
"@logMeal": {},
|
||||
"addIngredient": "Add ingredient",
|
||||
"@addIngredient": {},
|
||||
"nutritionalPlan": "Nutritional plan",
|
||||
|
||||
@@ -60,9 +60,39 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
|
||||
List<Widget> 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<Nutrition>(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<DashboardWorkoutWidget> {
|
||||
List<Widget> 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<DashboardWorkoutWidget> {
|
||||
children: [
|
||||
Text(s.exerciseObj.name),
|
||||
Text(s.repsText),
|
||||
SizedBox(height: 5),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
SizedBox(height: 15),
|
||||
],
|
||||
));
|
||||
});
|
||||
out.add(SizedBox(height: 10));
|
||||
out.add(Divider());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user