mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-01 02:02:35 +01:00
Mute the text for the nutritional values
The user should not see a spreadsheet when he opens the plan
This commit is contained in:
@@ -22,6 +22,7 @@ import 'package:flutter/material.dart';
|
||||
const Color wgerPrimaryColor = Color(0xff2a4c7d);
|
||||
const Color wgerPrimaryButtonColor = Color(0xff266dd3);
|
||||
const Color wgerSecondaryColor = Color(0xffe63946);
|
||||
const Color wgerTextMuted = Colors.black38;
|
||||
|
||||
// Chart colors
|
||||
const charts.Color wgerChartPrimaryColor = charts.Color(r: 0x2a, g: 0x4c, b: 0x7d);
|
||||
|
||||
33
lib/widgets/core/core.dart
Normal file
33
lib/widgets/core/core.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wger/theme/theme.dart';
|
||||
|
||||
class MutedText extends StatelessWidget {
|
||||
String _text;
|
||||
MutedText(
|
||||
this._text, {
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(_text, style: TextStyle(color: wgerTextMuted));
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import 'package:wger/models/nutrition/meal.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
import 'package:wger/widgets/core/bottom_sheet.dart';
|
||||
import 'package:wger/widgets/core/core.dart';
|
||||
import 'package:wger/widgets/nutrition/forms.dart';
|
||||
|
||||
class MealWidget extends StatelessWidget {
|
||||
@@ -35,10 +36,23 @@ class MealWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
child: Card(
|
||||
child: Column(
|
||||
children: [
|
||||
DismissibleMealHeader(meal: _meal),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MutedText('Energy'),
|
||||
MutedText("protein"),
|
||||
MutedText("carbohydrates"),
|
||||
MutedText("fat"),
|
||||
],
|
||||
),
|
||||
),
|
||||
..._meal.mealItems.map((item) => MealItemWidget(item)).toList(),
|
||||
OutlinedButton(
|
||||
child: Text('Add ingredient'),
|
||||
@@ -65,20 +79,23 @@ class MealItemWidget extends StatelessWidget {
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Table(
|
||||
columnWidths: {
|
||||
0: FlexColumnWidth(5),
|
||||
1: FlexColumnWidth(2),
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
TableRow(
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(
|
||||
'${_item.amount.toStringAsFixed(0)}$unit ${_item.ingredientObj.name}',
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('${_item.amount.toStringAsFixed(0)}$unit ${_item.ingredientObj.name}'),
|
||||
Text(
|
||||
'${values["energy"].toStringAsFixed(0)} kcal / ${values["energyKj"].toStringAsFixed(0)} kJ'),
|
||||
Text('${values["protein"].toStringAsFixed(0)}g'),
|
||||
Text('${values["carbohydrates"].toStringAsFixed(0)}g'),
|
||||
Text('${values["fat"].toStringAsFixed(0)}g'),
|
||||
MutedText('${values["energy"].toStringAsFixed(0)} kcal'),
|
||||
MutedText('${values["protein"].toStringAsFixed(0)}g'),
|
||||
MutedText('${values["carbohydrates"].toStringAsFixed(0)}g'),
|
||||
MutedText('${values["fat"].toStringAsFixed(0)}g'),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user