Skip to content

Commit 43b23d1

Browse files
App UI Dark Theme consistency
Updated the app's UI so that it's both Dark and Light theme consistent. Also set the "isDarkMode" variable global state so that it can be used by any widget for the theme consistency.. (added config/app_settings.dart) Seperated the navDrawer from home page so that code is more flexible and independent of child widget dependencies. (added drawer/nav_drawer.dart) Solved the Tags padding error (extra padding error between tags label and tags value) and also the UI of task details.
1 parent 54adc47 commit 43b23d1

File tree

13 files changed

+201
-56
lines changed

13 files changed

+201
-56
lines changed

lib/drawer/filter_drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FilterDrawer extends StatelessWidget {
1717
var storageWidget = StorageWidget.of(context);
1818
return Drawer(
1919
backgroundColor: AppSettings.isDarkMode
20-
? Color.fromARGB(137, 29, 29, 29)
20+
? Color.fromARGB(255, 29, 29, 29)
2121
: Colors.white,
2222
child: SafeArea(
2323
child: Padding(

lib/services/task_details.dart

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import 'package:flutter/material.dart';
44
import 'package:built_collection/built_collection.dart';
55
import 'package:google_fonts/google_fonts.dart';
6+
import 'package:taskwarrior/config/app_settings.dart';
67
import 'package:taskwarrior/model/storage/storage_widget.dart';
78
import 'package:taskwarrior/widgets/pallete.dart';
89
import 'package:taskwarrior/widgets/taskdetails.dart';
@@ -41,6 +42,9 @@ class _DetailRouteState extends State<DetailRoute> {
4142
@override
4243
Widget build(BuildContext context) {
4344
return Scaffold(
45+
backgroundColor: AppSettings.isDarkMode
46+
? const Color.fromARGB(255, 29, 29, 29)
47+
: Colors.white,
4448
appBar: AppBar(
4549
leading: const BackButton(color: Colors.white),
4650
backgroundColor: Palette.kToDark,
@@ -212,15 +216,23 @@ class AttributeWidget extends StatelessWidget {
212216
// );
213217
default:
214218
return Card(
215-
color: const Color(0x00000000),
216-
elevation: 0,
219+
color: AppSettings.isDarkMode
220+
? const Color.fromARGB(255, 57, 57, 57)
221+
: Colors.white,
217222
child: ListTile(
223+
textColor: AppSettings.isDarkMode
224+
? Colors.white
225+
: const Color.fromARGB(255, 48, 46, 46),
218226
title: SingleChildScrollView(
219227
scrollDirection: Axis.horizontal,
220228
child: Row(
221229
children: [
222230
Text(
223231
'${'$name:'.padRight(13)}$localValue',
232+
style: TextStyle(
233+
color:
234+
AppSettings.isDarkMode ? Colors.white : Colors.black,
235+
),
224236
),
225237
],
226238
),
@@ -245,13 +257,19 @@ class TagsWidget extends StatelessWidget {
245257
@override
246258
Widget build(BuildContext context) {
247259
return Card(
260+
color: AppSettings.isDarkMode
261+
? const Color.fromARGB(255, 57, 57, 57)
262+
: Colors.white,
248263
child: ListTile(
264+
textColor: AppSettings.isDarkMode
265+
? Colors.white
266+
: const Color.fromARGB(255, 48, 46, 46),
249267
title: SingleChildScrollView(
250268
scrollDirection: Axis.horizontal,
251269
child: Row(
252270
children: [
253271
Text(
254-
'${'$name:'.padRight(13)}${(value as ListBuilder?)?.build()}',
272+
'${'$name: '}${(value as ListBuilder?)?.build()}',
255273
style: GoogleFonts.firaMono(),
256274
),
257275
],

lib/views/profile/profile.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// ignore_for_file: file_names, unused_import, library_private_types_in_public_api
22
import 'dart:io';
33
import 'package:flutter/material.dart';
4+
import 'package:taskwarrior/config/app_settings.dart';
45
import 'package:taskwarrior/model/storage/savefile.dart';
56
import 'package:taskwarrior/taskserver/configure_taskserver.dart';
67
import 'package:taskwarrior/widgets/pallete.dart';
@@ -36,6 +37,8 @@ class _ProfilePageState extends State<ProfilePage> {
3637
),
3738
),
3839
//primary: false,
40+
backgroundColor:
41+
AppSettings.isDarkMode ? Palette.kToDark.shade200 : Colors.white,
3942
body: SingleChildScrollView(
4043
child: Column(
4144
children: [
@@ -118,10 +121,17 @@ class ProfilesColumn extends StatelessWidget {
118121
crossAxisAlignment: CrossAxisAlignment.center,
119122
children: [
120123
SelectProfile(currentProfile, profilesMap, selectProfile),
121-
const SizedBox(height: 6,),
124+
const SizedBox(
125+
height: 6,
126+
),
122127
ManageProfile(rename, configure, export, copy, delete),
123-
const SizedBox(height: 6,),
124-
ElevatedButton.icon(onPressed: addProfile, icon: const Icon(Icons.add), label: const Text('Add new Profile'))
128+
const SizedBox(
129+
height: 6,
130+
),
131+
ElevatedButton.icon(
132+
onPressed: addProfile,
133+
icon: const Icon(Icons.add),
134+
label: const Text('Add new Profile'))
125135
],
126136
),
127137
);

lib/widgets/addTask.dart

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import 'dart:developer';
44

55
import 'package:flutter/material.dart';
6+
import 'package:taskwarrior/config/app_settings.dart';
67
import 'package:taskwarrior/model/storage/storage_widget.dart';
78
import 'package:taskwarrior/widgets/taskfunctions/taskparser.dart';
89
import 'package:jiffy/jiffy.dart';
@@ -39,6 +40,9 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
3940
const title = 'Add Task';
4041

4142
return AlertDialog(
43+
backgroundColor: AppSettings.isDarkMode
44+
? const Color.fromARGB(255, 220, 216, 216)
45+
: Colors.white,
4246
title: const Center(child: Text(title)),
4347
content: Form(
4448
key: formKey,
@@ -56,8 +60,8 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
5660
children: [
5761
const Text(
5862
"Due : ",
59-
style:
60-
TextStyle(fontWeight: FontWeight.bold, height: 3.3),
63+
style: TextStyle(
64+
fontWeight: FontWeight.bold, height: 3.3),
6165
),
6266
GestureDetector(
6367
onLongPress: () {
@@ -68,9 +72,7 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
6872
backgroundColor: Colors.grey.shade300,
6973
label: Container(
7074
child: Text(
71-
(due != null)
72-
? dueString
73-
: "null",
75+
(due != null) ? dueString : "null",
7476
),
7577
),
7678
onPressed: () async {
@@ -88,7 +90,7 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
8890
var time = await showTimePicker(
8991
context: context,
9092
initialTime:
91-
TimeOfDay.fromDateTime(initialDate),
93+
TimeOfDay.fromDateTime(initialDate),
9294
);
9395
if (time != null) {
9496
var dateTime = date.add(
@@ -103,7 +105,8 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
103105
),
104106
);
105107
due = dateTime.toUtc();
106-
dueString = Jiffy(dateTime).format('MMM do yyyy, h:mm:ss a');
108+
dueString = Jiffy(dateTime)
109+
.format('MMM do yyyy, h:mm:ss a');
107110
}
108111
}
109112
setState(() {});
@@ -130,7 +133,6 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
130133
}
131134

132135
Widget buildName() => TextFormField(
133-
134136
controller: namecontroller,
135137
decoration: const InputDecoration(
136138
border: OutlineInputBorder(),
@@ -141,43 +143,46 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
141143
: null,
142144
);
143145
Widget buildPriority() => Column(children: [
144-
Row(
145-
mainAxisAlignment: MainAxisAlignment.start,
146-
crossAxisAlignment: CrossAxisAlignment.center,
147-
children: [
148-
const Text(
149-
'Priority : ',
150-
style: TextStyle(fontWeight: FontWeight.bold),
151-
textAlign: TextAlign.left,
146+
Row(
147+
mainAxisAlignment: MainAxisAlignment.start,
148+
crossAxisAlignment: CrossAxisAlignment.center,
149+
children: [
150+
const Text(
151+
'Priority : ',
152+
style: TextStyle(fontWeight: FontWeight.bold),
153+
textAlign: TextAlign.left,
154+
),
155+
DropdownButton<String>(
156+
dropdownColor: AppSettings.isDarkMode
157+
? const Color.fromARGB(255, 220, 216, 216)
158+
: Colors.white,
159+
value: priority,
160+
elevation: 16,
161+
style: const TextStyle(color: Colors.black),
162+
underline: Container(
163+
height: 1.5,
164+
color: Colors.black,
165+
),
166+
onChanged: (String? newValue) {
167+
setState(() {
168+
priority = newValue!;
169+
});
170+
},
171+
items: <String>['H', 'M', 'L']
172+
.map<DropdownMenuItem<String>>((String value) {
173+
return DropdownMenuItem<String>(
174+
value: value,
175+
child: Text(' $value'),
176+
);
177+
}).toList(),
178+
)
179+
],
152180
),
153-
DropdownButton<String>(
154-
value: priority,
155-
elevation: 16,
156-
style: const TextStyle(color: Colors.black),
157-
underline: Container(
158-
height: 1.5,
159-
color: Colors.black,
160-
),
161-
onChanged: (String? newValue) {
162-
setState(() {
163-
priority = newValue!;
164-
});
165-
},
166-
items: <String>['H', 'M', 'L']
167-
.map<DropdownMenuItem<String>>((String value) {
168-
return DropdownMenuItem<String>(
169-
value: value,
170-
child: Text(' $value'),
171-
);
172-
}).toList(),
173-
)
174-
],
175-
),
176-
]);
181+
]);
177182
Widget buildCancelButton(BuildContext context) => TextButton(
178-
child: const Text('Cancel'),
179-
onPressed: () => Navigator.of(context).pop(),
180-
);
183+
child: const Text('Cancel'),
184+
onPressed: () => Navigator.of(context).pop(),
185+
);
181186

182187
Widget buildAddButton(BuildContext context) {
183188
return TextButton(

lib/widgets/profilefunctions/manageprofile.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:taskwarrior/config/app_settings.dart';
23
import 'package:tuple/tuple.dart';
34

45
class ManageProfile extends StatelessWidget {
@@ -28,11 +29,26 @@ class ManageProfile extends StatelessWidget {
2829
];
2930

3031
return ExpansionTile(
32+
backgroundColor: AppSettings.isDarkMode
33+
? const Color.fromARGB(255, 48, 46, 46)
34+
: const Color.fromARGB(255, 220, 216, 216),
35+
iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
36+
collapsedIconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
37+
collapsedTextColor: AppSettings.isDarkMode
38+
? Colors.white
39+
: const Color.fromARGB(255, 48, 46, 46),
40+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
3141
key: const PageStorageKey<String>('manage-profile'),
3242
title: const Text('Manage selected profile'),
3343
children: [
3444
for (var triple in triples)
3545
ListTile(
46+
textColor: AppSettings.isDarkMode
47+
? Colors.white
48+
: const Color.fromARGB(255, 48, 46, 46),
49+
iconColor: AppSettings.isDarkMode
50+
? Colors.white
51+
: const Color.fromARGB(255, 48, 46, 46),
3652
leading: Padding(
3753
padding: const EdgeInsets.all(12),
3854
child: Icon(triple.item1),

lib/widgets/profilefunctions/selectprofile.dart

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:google_fonts/google_fonts.dart';
3+
import 'package:taskwarrior/config/app_settings.dart';
34

45
class SelectProfile extends StatelessWidget {
56
const SelectProfile(
@@ -17,7 +18,19 @@ class SelectProfile extends StatelessWidget {
1718
Widget build(BuildContext context) {
1819
return ExpansionTile(
1920
key: const PageStorageKey<String>('task-list'),
20-
title: Text('Profile: $currentProfile', overflow: TextOverflow.fade,),
21+
backgroundColor: AppSettings.isDarkMode
22+
? const Color.fromARGB(255, 48, 46, 46)
23+
: const Color.fromARGB(255, 220, 216, 216),
24+
iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
25+
collapsedIconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
26+
collapsedTextColor: AppSettings.isDarkMode
27+
? Colors.white
28+
: const Color.fromARGB(255, 48, 46, 46),
29+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
30+
title: Text(
31+
'Profile: $currentProfile',
32+
overflow: TextOverflow.fade,
33+
),
2134
children: [
2235
for (var entry in profilesMap.entries)
2336
SelectProfileListTile(
@@ -48,10 +61,22 @@ class SelectProfileListTile extends StatelessWidget {
4861
@override
4962
Widget build(BuildContext context) {
5063
return ListTile(
64+
textColor: AppSettings.isDarkMode
65+
? Colors.white
66+
: const Color.fromARGB(255, 48, 46, 46),
67+
iconColor: AppSettings.isDarkMode
68+
? Colors.white
69+
: const Color.fromARGB(255, 48, 46, 46),
5170
leading: Radio<String>(
5271
value: uuid,
5372
groupValue: selectedUuid,
5473
onChanged: (_) => select(),
74+
activeColor: AppSettings.isDarkMode
75+
? Colors.white
76+
: const Color.fromARGB(255, 48, 46, 46),
77+
focusColor: AppSettings.isDarkMode
78+
? Colors.white
79+
: const Color.fromARGB(255, 48, 46, 46),
5580
),
5681
title: SingleChildScrollView(
5782
key: PageStorageKey<String>('scroll-title-$uuid'),

lib/widgets/project_filter.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ class ProjectsColumn extends StatelessWidget {
5151
style: GoogleFonts.firaMono(
5252
color: AppSettings.isDarkMode ? Colors.white : Colors.black),
5353
),
54+
backgroundColor: AppSettings.isDarkMode
55+
? const Color.fromARGB(255, 48, 46, 46)
56+
: const Color.fromARGB(255, 220, 216, 216),
57+
iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
58+
collapsedIconColor:
59+
AppSettings.isDarkMode ? Colors.white : Colors.black,
5460
children: (Map.of(projects)
5561
..removeWhere((_, nodeData) => nodeData.parent != null))
5662
.keys
@@ -93,6 +99,12 @@ class ProjectTile extends StatelessWidget {
9399
);
94100

95101
var radio = Radio(
102+
activeColor: AppSettings.isDarkMode
103+
? Colors.white
104+
: const Color.fromARGB(255, 48, 46, 46),
105+
focusColor: AppSettings.isDarkMode
106+
? Colors.white
107+
: const Color.fromARGB(255, 48, 46, 46),
96108
toggleable: true,
97109
value: project,
98110
groupValue: projectFilter,

lib/widgets/tag_filter.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ class TagFiltersWrap extends StatelessWidget {
5252
entry.value.display,
5353
style: GoogleFonts.firaMono(
5454
fontWeight: entry.value.selected ? FontWeight.w700 : null,
55-
color: AppSettings.isDarkMode ? Colors.white : Colors.black),
55+
color: AppSettings.isDarkMode ? Colors.black : Colors.white),
5656
),
57+
backgroundColor: AppSettings.isDarkMode
58+
? const Color.fromARGB(255, 220, 216, 216)
59+
: const Color.fromARGB(255, 48, 46, 46),
5760
),
5861
],
5962
);

0 commit comments

Comments
 (0)