File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 16
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
*/
18
18
19
+ import 'package:flutter/widgets.dart' ;
20
+ import 'package:flutter_gen/gen_l10n/app_localizations.dart' ;
19
21
import 'package:json_annotation/json_annotation.dart' ;
20
22
import 'package:wger/helpers/consts.dart' ;
21
23
import 'package:wger/helpers/json.dart' ;
@@ -64,6 +66,10 @@ class NutritionalPlan {
64
66
65
67
Map <String , dynamic > toJson () => _$NutritionalPlanToJson (this );
66
68
69
+ String getLabel (BuildContext context) {
70
+ return description != '' ? description : AppLocalizations .of (context).nutritionalPlan;
71
+ }
72
+
67
73
/// Calculations
68
74
NutritionalValues get nutritionalValues {
69
75
// This is already done on the server. It might be better to read it from there.
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class NutritionalPlanScreen extends StatelessWidget {
101
101
),
102
102
],
103
103
flexibleSpace: FlexibleSpaceBar (
104
- title: Text (_nutritionalPlan.description ),
104
+ title: Text (_nutritionalPlan.getLabel (context) ),
105
105
background: const Image (
106
106
image: AssetImage ('assets/images/backgrounds/nutritional_plans.jpg' ),
107
107
fit: BoxFit .cover,
@@ -126,7 +126,7 @@ class NutritionalPlanScreen extends StatelessWidget {
126
126
)
127
127
: Consumer <NutritionPlansProvider >(
128
128
builder: (context, value, child) =>
129
- NutritionalPlanDetailWidget (_nutritionalPlan),
129
+ NutritionalPlanDetailWidget (_nutritionalPlan)
130
130
),
131
131
),
132
132
],
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class NutritionalPlansList extends StatelessWidget {
102
102
arguments: currentPlan,
103
103
);
104
104
},
105
- title: Text (currentPlan.description ),
105
+ title: Text (currentPlan.getLabel (context) ),
106
106
subtitle: Text (
107
107
DateFormat .yMd (Localizations .localeOf (context).languageCode)
108
108
.format (currentPlan.creationDate),
You can’t perform that action at this time.
0 commit comments