File tree Expand file tree Collapse file tree 4 files changed +14
-16
lines changed Expand file tree Collapse file tree 4 files changed +14
-16
lines changed Original file line number Diff line number Diff line change 100
100
"description": "The with target date status subtitle on the plan edit page",
101
101
"placeholders": {
102
102
"targetDate": {
103
- "type": "String"
103
+ "type": "DateTime",
104
+ "format": "yMd"
104
105
},
105
106
"direction": {
106
107
"type": "String"
119
120
"description": "The reset target date subtitle on the plan edit page",
120
121
"placeholders": {
121
122
"targetDate": {
122
- "type": "String"
123
+ "type": "DateTime",
124
+ "format": "yMd"
123
125
}
124
126
}
125
127
},
Original file line number Diff line number Diff line change @@ -57,8 +57,10 @@ class PlanEditDialog extends ConsumerWidget {
57
57
const SizedBox (height: 20 ),
58
58
PlanLanguageTile (planId),
59
59
PlanWithTargetDateTile (planId),
60
- if (plan.withTargetDate && plan.targetDate != adjustedTargetDate)
61
- PlanResetTargetDateTile (planId),
60
+ if (plan.withTargetDate &&
61
+ adjustedTargetDate != null &&
62
+ plan.targetDate != adjustedTargetDate)
63
+ PlanResetTargetDateTile (planId, adjustedTargetDate),
62
64
PlanShowEventsTile (planId),
63
65
PlanShowLocationsTile (planId),
64
66
if (! isNewPlan)
Original file line number Diff line number Diff line change @@ -4,26 +4,23 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
4
4
import 'package:nwt_reading/src/plans/stories/plan_edit_story.dart' ;
5
5
6
6
class PlanResetTargetDateTile extends ConsumerWidget {
7
- const PlanResetTargetDateTile (this .planId, {super .key});
7
+ const PlanResetTargetDateTile (this .planId, this .adjustedTargetDate,
8
+ {super .key});
8
9
9
10
final String ? planId;
11
+ final DateTime adjustedTargetDate;
10
12
11
13
@override
12
14
Widget build (BuildContext context, WidgetRef ref) {
13
15
ref.watch (planEditProviderFamily (planId));
14
16
final planEdit = ref.read (planEditProviderFamily (planId).notifier);
15
- final adjustedTargetDate = planEdit.calcTargetDate ();
16
- final formattedAdjustedTargetDate = adjustedTargetDate != null
17
- ? MaterialLocalizations .of (context)
18
- .formatCompactDate (adjustedTargetDate)
19
- : '' ;
20
17
21
18
return ListTile (
22
19
key: const Key ('reset-target-date' ),
23
20
title:
24
21
Text (AppLocalizations .of (context).planEditPageResetTargetDateTitle),
25
22
subtitle: Text (AppLocalizations .of (context)
26
- .planEditPageResetTargetDateSubtitle (formattedAdjustedTargetDate )),
23
+ .planEditPageResetTargetDateSubtitle (adjustedTargetDate )),
27
24
trailing: Icon (Icons .arrow_forward),
28
25
onTap: () {
29
26
showDialog <String >(
Original file line number Diff line number Diff line change @@ -14,9 +14,6 @@ class PlanWithTargetDateTile extends ConsumerWidget {
14
14
final plan = ref.watch (planEditProviderFamily (planId));
15
15
ref.watch (planEditProviderFamily (planId));
16
16
final planEdit = ref.read (planEditProviderFamily (planId).notifier);
17
- final formattedTargetDate = plan.targetDate != null
18
- ? MaterialLocalizations .of (context).formatCompactDate (plan.targetDate! )
19
- : '' ;
20
17
final planNotifier =
21
18
planId != null ? ref.read (planProviderFamily (planId! ).notifier) : null ;
22
19
final deviationDays = planNotifier? .getDeviationDays () ?? 0 ;
@@ -27,12 +24,12 @@ class PlanWithTargetDateTile extends ConsumerWidget {
27
24
crossAxisAlignment: CrossAxisAlignment .start,
28
25
children: < Widget > [
29
26
Text (AppLocalizations .of (context).planEditPageWithTargetDateSubtitle),
30
- if (planId != null && plan.withTargetDate)
27
+ if (planId != null && plan.withTargetDate && plan.targetDate != null )
31
28
Text (
32
29
key: const Key ('target-status' ),
33
30
AppLocalizations .of (context)
34
31
.planEditPageWithTargetDateStatusSubtitle (
35
- formattedTargetDate ,
32
+ plan.targetDate ! ,
36
33
deviationDays > 0
37
34
? 'ahead'
38
35
: deviationDays < 0
You can’t perform that action at this time.
0 commit comments