Skip to content

Commit facf7d2

Browse files
committed
fix: normalize priority X to prevent false diffs
1 parent 6076f62 commit facf7d2

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

lib/app/modules/detailRoute/views/priority_widget.dart

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ class PriorityWidget extends StatelessWidget {
2121

2222
@override
2323
Widget build(BuildContext context) {
24-
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
24+
TaskwarriorColorTheme tColors =
25+
Theme.of(context).extension<TaskwarriorColorTheme>()!;
2526
final Color? textColor = isEditable
2627
? tColors.primaryTextColor
2728
: tColors.primaryDisabledTextColor;
2829

30+
// Normalize value: null → X
31+
final String priority =
32+
(value == null || value == '') ? 'X' : value.toString();
33+
2934
return Card(
3035
key: globalKey,
3136
color: tColors.secondaryBackgroundColor,
@@ -48,7 +53,7 @@ class PriorityWidget extends StatelessWidget {
4853
),
4954
),
5055
TextSpan(
51-
text: value ?? "not selected",
56+
text: priority, // Always show X / H / M / L
5257
style: GoogleFonts.poppins(
5358
fontSize: TaskWarriorFonts.fontSizeMedium,
5459
color: textColor,
@@ -60,18 +65,24 @@ class PriorityWidget extends StatelessWidget {
6065
],
6166
),
6267
),
63-
onTap: () {
64-
switch (value) {
65-
case 'H':
66-
return callback('M');
67-
case 'M':
68-
return callback('L');
69-
case 'L':
70-
return callback(null);
71-
default:
72-
return callback('H');
73-
}
74-
},
68+
onTap: isEditable
69+
? () {
70+
switch (priority) {
71+
case 'X':
72+
callback('H');
73+
break;
74+
case 'H':
75+
callback('M');
76+
break;
77+
case 'M':
78+
callback('L');
79+
break;
80+
case 'L':
81+
callback('X');
82+
break;
83+
}
84+
}
85+
: null,
7586
),
7687
);
7788
}

0 commit comments

Comments
 (0)