Skip to content

Commit 55d36eb

Browse files
committed
improve design
1 parent 12c1d00 commit 55d36eb

File tree

2 files changed

+40
-34
lines changed

2 files changed

+40
-34
lines changed

lib/l10n/app_en.arb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@
278278
},
279279
"onlyLogging": "Only track calories",
280280
"onlyLoggingHelpText": "Check the box if you only want to log your calories and don't want to setup a detailed nutritional plan with specific meals",
281-
"addGoalsToPlan": "Add goals to this plan",
282-
"addGoalsToPlanHelpText": "This allows you to set general goals for energy, protein, carbohydrates or fat for the plan. Note that if you set-up a detailed meal plan, these values will take precedence.",
283281
"goalEnergy": "Energy goal",
284282
"goalProtein": "Protein goal",
285283
"goalCarbohydrates": "Carbohydrates goal",
@@ -431,7 +429,7 @@
431429
},
432430
"saturatedFat": "Saturated fat",
433431
"@saturatedFat": {},
434-
"fibres": "Fibre",
432+
"fibres": "Fibers",
435433
"@fibres": {},
436434
"sodium": "Sodium",
437435
"@sodium": {},

lib/widgets/nutrition/forms.dart

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ class IngredientLogForm extends StatelessWidget {
392392
}
393393

394394
enum GoalType {
395-
meals('Based on my meals'),
396-
basic('Set basic macros'),
397-
advanced('Set advanced macros');
395+
meals('From meals'),
396+
basic('Basic'),
397+
advanced('Advanced');
398398

399399
const GoalType(this.label);
400400
final String label;
@@ -464,34 +464,42 @@ class _PlanFormState extends State<PlanForm> {
464464
widget._plan.onlyLogging = value;
465465
},
466466
),
467-
DropdownButtonFormField<GoalType>(
468-
value: _goalType,
469-
items: GoalType.values
470-
.map(
471-
(e) => DropdownMenuItem<GoalType>(value: e, child: Text(e.label)),
472-
)
473-
.toList(),
474-
onChanged: (GoalType? g) {
475-
setState(() {
476-
if (g == null) {
477-
return;
478-
}
479-
switch (g) {
480-
case GoalType.meals:
481-
widget._plan.goalEnergy = null;
482-
widget._plan.goalProtein = null;
483-
widget._plan.goalCarbohydrates = null;
484-
widget._plan.goalFat = null;
485-
widget._plan.goalFibers = null;
486-
case GoalType.basic:
487-
widget._plan.goalFibers = null;
488-
break;
489-
default:
490-
break;
491-
}
492-
_goalType = g;
493-
});
494-
},
467+
Row(
468+
children: [
469+
Text('Macro goals', style: Theme.of(context).textTheme.titleMedium),
470+
const SizedBox(width: 8),
471+
Expanded(
472+
child: DropdownButtonFormField<GoalType>(
473+
value: _goalType,
474+
items: GoalType.values
475+
.map(
476+
(e) => DropdownMenuItem<GoalType>(value: e, child: Text(e.label)),
477+
)
478+
.toList(),
479+
onChanged: (GoalType? g) {
480+
setState(() {
481+
if (g == null) {
482+
return;
483+
}
484+
switch (g) {
485+
case GoalType.meals:
486+
widget._plan.goalEnergy = null;
487+
widget._plan.goalProtein = null;
488+
widget._plan.goalCarbohydrates = null;
489+
widget._plan.goalFat = null;
490+
widget._plan.goalFibers = null;
491+
case GoalType.basic:
492+
widget._plan.goalFibers = null;
493+
break;
494+
default:
495+
break;
496+
}
497+
_goalType = g;
498+
});
499+
},
500+
),
501+
),
502+
],
495503
),
496504
if (_goalType == GoalType.basic || _goalType == GoalType.advanced)
497505
Column(

0 commit comments

Comments
 (0)