Skip to content

Commit 1a42245

Browse files
Home UI Enhacement
Changed the task_list_item.dart file in order to improve the UI of task items in home page with clear view to priorities and other details of tasks
1 parent 24cfcda commit 1a42245

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

lib/services/task_list_tem.dart

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
1-
import 'package:flutter/foundation.dart';
21
import 'package:flutter/material.dart';
32

43
import 'package:google_fonts/google_fonts.dart';
54
import 'package:taskwarrior/widgets/taskw.dart';
65
import 'package:taskwarrior/model/json.dart';
76

87
class TaskListItem extends StatelessWidget {
9-
const TaskListItem(this.task, {this.pendingFilter = false, Key? key, required this.darkmode})
8+
const TaskListItem(this.task,
9+
{this.pendingFilter = false, Key? key, required this.darkmode})
1010
: super(key: key);
1111

1212
final Task task;
1313
final bool pendingFilter;
1414
final bool darkmode;
15-
1615

1716
@override
1817
Widget build(BuildContext context) {
19-
var colour =darkmode? Colors.white:Colors.black;
18+
var colour = darkmode ? Colors.white : Colors.black;
19+
var dimColor = darkmode
20+
? const Color.fromARGB(137, 248, 248, 248)
21+
: const Color.fromARGB(136, 17, 17, 17);
2022
return ListTile(
23+
leading: Icon(
24+
Icons.circle,
25+
color: task.priority == 'H'
26+
? Colors.red
27+
: task.priority == 'M'
28+
? Colors.yellow[600]
29+
: Colors.green,
30+
size: 20,
31+
semanticLabel: 'Priority',
32+
),
2133
title: Row(
2234
mainAxisAlignment: MainAxisAlignment.spaceBetween,
2335
children: [
2436
Flexible(
2537
child: SingleChildScrollView(
2638
scrollDirection: Axis.horizontal,
2739
child: Text(
28-
task.description,
29-
style: TextStyle(color:colour,fontFamily: GoogleFonts.firaMono().fontFamily),
40+
'${(task.id == 0) ? '#' : task.id}. ${task.description}',
41+
style: TextStyle(
42+
color: colour,
43+
fontFamily: GoogleFonts.firaMono().fontFamily),
3044
),
3145
),
3246
),
3347
Text(
3448
(task.annotations != null) ? ' [${task.annotations!.length}]' : '',
35-
style: TextStyle(color:colour,fontFamily: GoogleFonts.firaMono().fontFamily),
49+
style: TextStyle(
50+
color: colour, fontFamily: GoogleFonts.firaMono().fontFamily),
3651
),
3752
],
3853
),
@@ -43,28 +58,27 @@ class TaskListItem extends StatelessWidget {
4358
child: SingleChildScrollView(
4459
scrollDirection: Axis.horizontal,
4560
child: Text(
46-
'${(task.id == 0) ? '-' : task.id} '
47-
'${pendingFilter ? '' : '${task.status[0].toUpperCase()} '}'
48-
'${age(task.entry)} '
49-
'${(task.modified != null) ? 'm:${age(task.modified!)}' : ''} '
50-
'${(task.start != null) ? 'st:${age(task.start!)}' : ''} '
51-
'${(task.due != null) ? 'd:${when(task.due!)}' : ''} '
52-
'${task.priority ?? ''} '
53-
'${task.project ?? ''} '
54-
'[${task.tags?.join(',') ?? ''}]'
61+
'${pendingFilter ? '' : '${task.status[0].toUpperCase()}\n'}'
62+
'Last Modified: ${(task.modified != null) ? age(task.modified!) : ((task.start != null) ? age(task.start!) : '-')} | '
63+
'Due: ${(task.due != null) ? when(task.due!) : '-'}'
5564
.replaceFirst(RegExp(r' \[\]$'), '')
5665
.replaceAll(RegExp(r' +'), ' '),
57-
style: TextStyle(color: colour,fontFamily: GoogleFonts.firaMono().fontFamily),
58-
66+
style: TextStyle(
67+
color: dimColor,
68+
fontFamily: GoogleFonts.firaMono().fontFamily,
69+
fontSize: 12,
70+
overflow: TextOverflow.ellipsis),
5971
),
6072
),
6173
),
6274
Text(
6375
formatUrgency(urgency(task)),
64-
style: TextStyle(color:colour,fontFamily: GoogleFonts.firaMono().fontFamily),
76+
style: TextStyle(
77+
color: colour, fontFamily: GoogleFonts.firaMono().fontFamily),
6578
),
6679
],
6780
),
81+
// isThreeLine: true,
6882
);
6983
}
7084
}

pubspec.lock

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ packages:
3535
name: async
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "2.8.2"
38+
version: "2.9.0"
3939
boolean_selector:
4040
dependency: transitive
4141
description:
@@ -105,14 +105,7 @@ packages:
105105
name: characters
106106
url: "https://pub.dartlang.org"
107107
source: hosted
108-
version: "1.2.0"
109-
charcode:
110-
dependency: transitive
111-
description:
112-
name: charcode
113-
url: "https://pub.dartlang.org"
114-
source: hosted
115-
version: "1.3.1"
108+
version: "1.2.1"
116109
checked_yaml:
117110
dependency: transitive
118111
description:
@@ -126,7 +119,7 @@ packages:
126119
name: clock
127120
url: "https://pub.dartlang.org"
128121
source: hosted
129-
version: "1.1.0"
122+
version: "1.1.1"
130123
code_builder:
131124
dependency: transitive
132125
description:
@@ -196,7 +189,7 @@ packages:
196189
name: fake_async
197190
url: "https://pub.dartlang.org"
198191
source: hosted
199-
version: "1.3.0"
192+
version: "1.3.1"
200193
ffi:
201194
dependency: transitive
202195
description:
@@ -456,21 +449,21 @@ packages:
456449
name: matcher
457450
url: "https://pub.dartlang.org"
458451
source: hosted
459-
version: "0.12.11"
452+
version: "0.12.12"
460453
material_color_utilities:
461454
dependency: transitive
462455
description:
463456
name: material_color_utilities
464457
url: "https://pub.dartlang.org"
465458
source: hosted
466-
version: "0.1.4"
459+
version: "0.1.5"
467460
meta:
468461
dependency: transitive
469462
description:
470463
name: meta
471464
url: "https://pub.dartlang.org"
472465
source: hosted
473-
version: "1.7.0"
466+
version: "1.8.0"
474467
mime:
475468
dependency: transitive
476469
description:
@@ -533,7 +526,7 @@ packages:
533526
name: path
534527
url: "https://pub.dartlang.org"
535528
source: hosted
536-
version: "1.8.1"
529+
version: "1.8.2"
537530
path_provider:
538531
dependency: transitive
539532
description:
@@ -741,7 +734,7 @@ packages:
741734
name: source_span
742735
url: "https://pub.dartlang.org"
743736
source: hosted
744-
version: "1.8.2"
737+
version: "1.9.0"
745738
stack_trace:
746739
dependency: transitive
747740
description:
@@ -769,7 +762,7 @@ packages:
769762
name: string_scanner
770763
url: "https://pub.dartlang.org"
771764
source: hosted
772-
version: "1.1.0"
765+
version: "1.1.1"
773766
synchronized:
774767
dependency: transitive
775768
description:
@@ -783,14 +776,14 @@ packages:
783776
name: term_glyph
784777
url: "https://pub.dartlang.org"
785778
source: hosted
786-
version: "1.2.0"
779+
version: "1.2.1"
787780
test_api:
788781
dependency: transitive
789782
description:
790783
name: test_api
791784
url: "https://pub.dartlang.org"
792785
source: hosted
793-
version: "0.4.9"
786+
version: "0.4.12"
794787
timing:
795788
dependency: transitive
796789
description:

0 commit comments

Comments
 (0)