17
17
*/
18
18
19
19
import 'package:flutter/material.dart' ;
20
+ import 'package:intl/intl.dart' ;
20
21
import 'package:provider/provider.dart' ;
21
22
import 'package:wger/l10n/generated/app_localizations.dart' ;
22
23
import 'package:wger/models/nutrition/nutritional_plan.dart' ;
@@ -44,6 +45,26 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
44
45
return SliverList (
45
46
delegate: SliverChildListDelegate (
46
47
[
48
+ const SizedBox (height: 16 ),
49
+ Padding (
50
+ padding: const EdgeInsets .symmetric (horizontal: 16.0 ),
51
+ child: Text (
52
+ _nutritionalPlan.endDate != null
53
+ ? 'from ${DateFormat .yMd (
54
+ Localizations .localeOf (context ).languageCode ,
55
+ ).format (_nutritionalPlan .startDate )} to ${DateFormat .yMd (
56
+ Localizations .localeOf (context ).languageCode ,
57
+ ).format (_nutritionalPlan .endDate !)}'
58
+ : 'from ${DateFormat .yMd (
59
+ Localizations .localeOf (context ).languageCode ,
60
+ ).format (_nutritionalPlan .startDate )} (open ended)' ,
61
+ style: Theme .of (context).textTheme.titleSmall? .copyWith (
62
+ fontStyle: FontStyle .italic,
63
+ ),
64
+ textAlign: TextAlign .center,
65
+ ),
66
+ ),
67
+ const SizedBox (height: 8 ),
47
68
SizedBox (
48
69
width: 300 ,
49
70
child: Padding (
@@ -53,49 +74,6 @@ class NutritionalPlanDetailWidget extends StatelessWidget {
53
74
),
54
75
),
55
76
),
56
- Padding (
57
- padding:
58
- const EdgeInsets .symmetric (horizontal: 16.0 , vertical: 8.0 ),
59
- child: Column (
60
- crossAxisAlignment: CrossAxisAlignment .start,
61
- children: [
62
- Row (
63
- children: [
64
- Text (
65
- '${AppLocalizations .of (context ).start }: ' ,
66
- style: Theme .of (context)
67
- .textTheme
68
- .titleMedium!
69
- .copyWith (fontWeight: FontWeight .bold),
70
- ),
71
- Text (
72
- '${_nutritionalPlan .startDate .day .toString ().padLeft (2 , '0' )}.${_nutritionalPlan .startDate .month .toString ().padLeft (2 , '0' )}.${_nutritionalPlan .startDate .year }' ,
73
- style: Theme .of (context).textTheme.titleMedium,
74
- ),
75
- ],
76
- ),
77
- if (_nutritionalPlan.endDate != null )
78
- Padding (
79
- padding: const EdgeInsets .only (top: 4.0 ),
80
- child: Row (
81
- children: [
82
- Text (
83
- '${AppLocalizations .of (context ).endDate }: ' ,
84
- style: Theme .of (context)
85
- .textTheme
86
- .titleMedium!
87
- .copyWith (fontWeight: FontWeight .bold),
88
- ),
89
- Text (
90
- '${_nutritionalPlan .endDate !.day .toString ().padLeft (2 , '0' )}.${_nutritionalPlan .endDate !.month .toString ().padLeft (2 , '0' )}.${_nutritionalPlan .endDate !.year }' ,
91
- style: Theme .of (context).textTheme.titleMedium,
92
- ),
93
- ],
94
- ),
95
- ),
96
- ],
97
- ),
98
- ),
99
77
const SizedBox (height: 10 ),
100
78
..._nutritionalPlan.meals.map ((meal) => MealWidget (
101
79
meal,
0 commit comments