Skip to content

Commit cbcc94a

Browse files
author
afjal1
committed
Fixed Negative Dues Time
1 parent df183d0 commit cbcc94a

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

lib/services/task_list_tem.dart

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ class _TaskListItemState extends State<TaskListItem> {
7373
decoration: BoxDecoration(
7474
border: Border.all(
7575
color: (widget.task.due != null &&
76-
isDueWithinOneDay(widget.task.due!) && useDelayTask)
77-
? Colors.red // Set border color to red if due within 1 day and useDelayTask is true
76+
isDueWithinOneDay(widget.task.due!) &&
77+
useDelayTask)
78+
? Colors
79+
.red // Set border color to red if due within 1 day and useDelayTask is true
7880
: dimColor, // Set default border color
7981
),
8082
borderRadius: BorderRadius.circular(8.0),
@@ -91,13 +93,9 @@ class _TaskListItemState extends State<TaskListItem> {
9193
),
9294
const SizedBox(width: 8),
9395
SizedBox(
94-
width: MediaQuery
95-
.of(context)
96-
.size
97-
.width * 0.70,
96+
width: MediaQuery.of(context).size.width * 0.70,
9897
child: Text(
99-
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget
100-
.task.description}',
98+
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget.task.description}',
10199
maxLines: 1,
102100
overflow: TextOverflow.ellipsis,
103101
style: GoogleFonts.poppins(
@@ -124,14 +122,9 @@ class _TaskListItemState extends State<TaskListItem> {
124122
child: SingleChildScrollView(
125123
scrollDirection: Axis.horizontal,
126124
child: Text(
127-
'${widget.pendingFilter ? '' : '${widget.task.status[0]
128-
.toUpperCase()}\n'}'
129-
'Last Modified: ${(widget.task.modified != null) ? age(
130-
widget.task.modified!) : ((widget.task.start != null)
131-
? age(widget.task.start!)
132-
: '-')} | '
133-
'Due: ${(widget.task.due != null) ? when(
134-
widget.task.due!) : '-'}'
125+
'${widget.pendingFilter ? '' : '${widget.task.status[0].toUpperCase()}\n'}'
126+
'Last Modified: ${(widget.task.modified != null) ? age(widget.task.modified!) : ((widget.task.start != null) ? age(widget.task.start!) : '-')} | '
127+
'Due: ${(widget.task.due != null) ? when(widget.task.due!) : '-'}'
135128
.replaceFirst(RegExp(r' \[\]$'), '')
136129
.replaceAll(RegExp(r' +'), ' '),
137130
overflow: TextOverflow.ellipsis,
@@ -166,13 +159,9 @@ class _TaskListItemState extends State<TaskListItem> {
166159
),
167160
const SizedBox(width: 8),
168161
SizedBox(
169-
width: MediaQuery
170-
.of(context)
171-
.size
172-
.width * 0.65,
162+
width: MediaQuery.of(context).size.width * 0.65,
173163
child: Text(
174-
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget
175-
.task.description}',
164+
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget.task.description}',
176165
maxLines: 1,
177166
overflow: TextOverflow.ellipsis,
178167
style: GoogleFonts.poppins(
@@ -191,13 +180,8 @@ class _TaskListItemState extends State<TaskListItem> {
191180
child: SingleChildScrollView(
192181
scrollDirection: Axis.horizontal,
193182
child: Text(
194-
'Last Modified: ${(widget.task.modified != null) ? age(
195-
widget.task.modified!) : ((widget.task.start != null)
196-
? age(widget.task.start!)
197-
: '-')} | '
198-
'Due: ${(widget.task.due != null)
199-
? when(widget.task.due!)
200-
: '-'}'
183+
'Last Modified: ${(widget.task.modified != null) ? age(widget.task.modified!) : ((widget.task.start != null) ? age(widget.task.start!) : '-')} | '
184+
'Due: ${(widget.task.due != null) ? when(widget.task.due!) : '-'}'
201185
.replaceFirst(RegExp(r' \[\]$'), '')
202186
.replaceAll(RegExp(r' +'), ' '),
203187
overflow: TextOverflow.ellipsis,

lib/widgets/taskfunctions/datetime_differences.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ String difference(Duration difference) {
2121
} else {
2222
result = '${difference.abs().inSeconds}s';
2323
}
24-
return '${(difference.isNegative) ? '-' : ''}$result';
24+
return '$result ${(difference.isNegative) ? 'ago ' : ''}';
2525
}

0 commit comments

Comments
 (0)