mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-03 02:24:30 +01:00
Improve detail view of meals
The header and values are now better centered, making this a bit more visually pleasing
This commit is contained in:
@@ -21,14 +21,25 @@ import 'package:wger/theme/theme.dart';
|
||||
|
||||
class MutedText extends StatelessWidget {
|
||||
String _text;
|
||||
TextAlign _textAlign = TextAlign.left;
|
||||
|
||||
MutedText(
|
||||
this._text, {
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
TextAlign? textAlign,
|
||||
}) : super(key: key) {
|
||||
if (textAlign != null) {
|
||||
this._textAlign = textAlign;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(_text, style: TextStyle(color: wgerTextMuted));
|
||||
return Text(
|
||||
_text,
|
||||
style: TextStyle(color: wgerTextMuted),
|
||||
textAlign: _textAlign,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,31 @@ class _MealWidgetState extends State<MealWidget> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MutedText(AppLocalizations.of(context)!.energy),
|
||||
MutedText(AppLocalizations.of(context)!.protein),
|
||||
MutedText(AppLocalizations.of(context)!.carbohydrates),
|
||||
MutedText(AppLocalizations.of(context)!.fat),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.energy,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.protein,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.carbohydrates,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
AppLocalizations.of(context)!.fat,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -141,14 +160,31 @@ class MealItemWidget extends StatelessWidget {
|
||||
),
|
||||
if (_expanded)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MutedText(
|
||||
'${values.energy.toStringAsFixed(0)} ${AppLocalizations.of(context)!.kcal}'),
|
||||
MutedText('${values.protein.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}'),
|
||||
MutedText(
|
||||
'${values.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}'),
|
||||
MutedText('${values.fat.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}'),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.energy.toStringAsFixed(0)} ${AppLocalizations.of(context)!.kcal}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.protein.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.carbohydrates.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: MutedText(
|
||||
'${values.fat.toStringAsFixed(0)}${AppLocalizations.of(context)!.g}',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user