Skip to content

Commit 35f58f4

Browse files
authored
Merge pull request #302 from its-me-abhishek/main
Added a theme based global color config and updated the relevant widgets
2 parents e91dbc3 + 2fc240f commit 35f58f4

30 files changed

+1415
-639
lines changed

lib/config/taskwarriorcolors.dart

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
// ignore_for_file: file_names
22

33
import 'package:flutter/material.dart';
4+
import 'package:taskwarrior/widgets/pallete.dart';
45

5-
class Appcolors {
6+
class TaskWarriorColors {
7+
// Normal Colors
68
static Color red = Colors.red;
79
static Color green = Colors.green;
810
static Color yellow = Colors.yellow;
911
static Color white = Colors.white;
12+
static Color black = Colors.black;
13+
static Color grey = Colors.grey;
14+
static Color? lightGrey = Colors.grey[600];
15+
static Color purple = Colors.purple;
16+
static Color borderColor = Colors.grey.shade300;
17+
static Color deepPurpleAccent = Colors.deepPurpleAccent;
18+
static Color deepPurple = Colors.deepPurple;
19+
20+
// Dark Theme Color Palette
21+
static Color kprimaryBackgroundColor = Palette.kToDark.shade200;
22+
static Color ksecondaryBackgroundColor =
23+
const Color.fromARGB(255, 48, 46, 46);
24+
static Color kprimaryTextColor = Colors.white;
25+
static Color ksecondaryTextColor = Colors.white;
26+
static Color kprimaryDisabledTextColor = const Color(0xff595f6b);
27+
static Color kdialogBackGroundColor = const Color.fromARGB(255, 25, 25, 25);
28+
29+
// Light Theme Color Palette
30+
static Color kLightPrimaryBackgroundColor = Colors.white;
31+
static Color kLightSecondaryBackgroundColor =
32+
const Color.fromARGB(255, 220, 216, 216);
33+
static Color kLightPrimaryTextColor = Colors.black;
34+
static Color kLightSecondaryTextColor = const Color.fromARGB(255, 48, 46, 46);
35+
static Color kLightPrimaryDisabledTextColor = const Color(0xffACACAB);
36+
static Color kLightDialogBackGroundColor = Colors.white;
1037
}

lib/config/theme_switcher_clipper.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// ignore_for_file: library_private_types_in_public_api
22

33
import 'package:flutter/material.dart';
4+
import 'package:taskwarrior/config/taskwarriorcolors.dart';
45

56
class ThemeSwitcherClipper extends StatefulWidget {
67
final bool isDarkMode;
@@ -36,7 +37,9 @@ class _ThemeSwitcherClipperState extends State<ThemeSwitcherClipper> {
3637
child: Icon(
3738
widget.isDarkMode ? Icons.dark_mode : Icons.light_mode,
3839
key: UniqueKey(),
39-
color: widget.isDarkMode ? Colors.white : Colors.black,
40+
color: widget.isDarkMode
41+
? TaskWarriorColors.white
42+
: TaskWarriorColors.black,
4043
size: 40,
4144
),
4245
)),

lib/drawer/filter_drawer.dart

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
44
import 'package:google_fonts/google_fonts.dart';
55

66
import 'package:taskwarrior/config/app_settings.dart';
7+
import 'package:taskwarrior/config/taskwarriorcolors.dart';
78
import 'package:taskwarrior/controller/filter_drawer_tour_controller.dart';
89
import 'package:taskwarrior/drawer/filter_drawer_tour.dart';
910
import 'package:taskwarrior/model/storage/storage_widget.dart';
@@ -30,8 +31,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
3031

3132
bool isSaved = false;
3233
var tileColor = AppSettings.isDarkMode
33-
? const Color.fromARGB(255, 48, 46, 46)
34-
: const Color.fromARGB(255, 220, 216, 216);
34+
? TaskWarriorColors.ksecondaryBackgroundColor
35+
: TaskWarriorColors.kLightPrimaryBackgroundColor;
3536
late TutorialCoachMark tutorialCoachMark;
3637

3738
void _initFilterDrawerTour() {
@@ -42,7 +43,7 @@ class _FilterDrawerState extends State<FilterDrawer> {
4243
filterTagKey: filterTagKey,
4344
sortByKey: sortByKey,
4445
),
45-
colorShadow: Colors.black,
46+
colorShadow: TaskWarriorColors.black,
4647
paddingFocus: 10,
4748
opacityShadow: 1.00,
4849
hideSkip: true,
@@ -83,8 +84,11 @@ class _FilterDrawerState extends State<FilterDrawer> {
8384
var storageWidget = StorageWidget.of(context);
8485
return Drawer(
8586
backgroundColor: AppSettings.isDarkMode
86-
? Color.fromARGB(255, 29, 29, 29)
87-
: Colors.white,
87+
? TaskWarriorColors.kprimaryBackgroundColor
88+
: TaskWarriorColors.kLightPrimaryBackgroundColor,
89+
surfaceTintColor: AppSettings.isDarkMode
90+
? TaskWarriorColors.kprimaryBackgroundColor
91+
: TaskWarriorColors.kLightPrimaryBackgroundColor,
8892
child: SafeArea(
8993
child: Padding(
9094
padding: const EdgeInsets.all(8),
@@ -105,8 +109,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
105109
style: GoogleFonts.poppins(
106110
fontWeight: FontWeight.bold,
107111
color: (AppSettings.isDarkMode
108-
? Colors.white
109-
: Color.fromARGB(255, 48, 46, 46)),
112+
? TaskWarriorColors.kprimaryTextColor
113+
: TaskWarriorColors.kLightPrimaryTextColor),
110114
fontSize: 25),
111115
),
112116
),
@@ -120,7 +124,7 @@ class _FilterDrawerState extends State<FilterDrawer> {
120124
decoration: BoxDecoration(
121125
color: tileColor,
122126
borderRadius: BorderRadius.circular(8),
123-
border: Border.all(color: Colors.grey.shade300),
127+
border: Border.all(color: TaskWarriorColors.borderColor),
124128
),
125129
child: ListTile(
126130
contentPadding: EdgeInsets.only(
@@ -137,8 +141,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
137141
fontWeight: FontWeight.bold,
138142
fontSize: 15,
139143
color: AppSettings.isDarkMode
140-
? Colors.white
141-
: Colors.black,
144+
? TaskWarriorColors.white
145+
: TaskWarriorColors.black,
142146
),
143147
),
144148
TextSpan(
@@ -148,17 +152,17 @@ class _FilterDrawerState extends State<FilterDrawer> {
148152
style: GoogleFonts.poppins(
149153
fontSize: 15,
150154
color: AppSettings.isDarkMode
151-
? Colors.white
152-
: Colors.black,
155+
? TaskWarriorColors.white
156+
: TaskWarriorColors.black,
153157
),
154158
),
155159
],
156160
),
157161
),
158162
onTap: widget.filters.togglePendingFilter,
159163
textColor: AppSettings.isDarkMode
160-
? Colors.white
161-
: Color.fromARGB(255, 48, 46, 46),
164+
? TaskWarriorColors.kprimaryTextColor
165+
: TaskWarriorColors.kLightSecondaryTextColor,
162166
),
163167
),
164168
const Divider(
@@ -171,7 +175,7 @@ class _FilterDrawerState extends State<FilterDrawer> {
171175
decoration: BoxDecoration(
172176
color: tileColor,
173177
borderRadius: BorderRadius.circular(8),
174-
border: Border.all(color: Colors.grey.shade300),
178+
border: Border.all(color: TaskWarriorColors.borderColor),
175179
),
176180
child: ProjectsColumn(
177181
widget.filters.projects,
@@ -189,7 +193,7 @@ class _FilterDrawerState extends State<FilterDrawer> {
189193
decoration: BoxDecoration(
190194
color: tileColor,
191195
borderRadius: BorderRadius.circular(8),
192-
border: Border.all(color: Colors.grey.shade300),
196+
border: Border.all(color: TaskWarriorColors.borderColor),
193197
),
194198
child: Column(
195199
mainAxisAlignment: MainAxisAlignment.center,
@@ -203,8 +207,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
203207
'Filter Tag By:',
204208
style: GoogleFonts.poppins(
205209
color: (AppSettings.isDarkMode
206-
? Colors.white
207-
: Color.fromARGB(255, 48, 46, 46)),
210+
? TaskWarriorColors.kprimaryTextColor
211+
: TaskWarriorColors.kLightSecondaryTextColor),
208212
//
209213
fontSize: 18),
210214
//textAlign: TextAlign.right,
@@ -233,7 +237,7 @@ class _FilterDrawerState extends State<FilterDrawer> {
233237
decoration: BoxDecoration(
234238
color: tileColor,
235239
borderRadius: BorderRadius.circular(8),
236-
border: Border.all(color: Colors.grey.shade300),
240+
border: Border.all(color: TaskWarriorColors.borderColor),
237241
),
238242
//height: 30,
239243
child: Column(
@@ -247,8 +251,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
247251
'Sort By',
248252
style: GoogleFonts.poppins(
249253
color: (AppSettings.isDarkMode
250-
? Colors.white
251-
: Color.fromARGB(255, 48, 46, 46)),
254+
? TaskWarriorColors.kprimaryTextColor
255+
: TaskWarriorColors.kLightPrimaryTextColor),
252256
fontSize: 18),
253257
// textAlign: TextAlign.right,
254258
),
@@ -292,11 +296,12 @@ class _FilterDrawerState extends State<FilterDrawer> {
292296
},
293297
labelStyle: GoogleFonts.poppins(
294298
color: AppSettings.isDarkMode
295-
? Colors.black
296-
: Colors.white),
299+
? TaskWarriorColors.black
300+
: TaskWarriorColors.white),
297301
backgroundColor: AppSettings.isDarkMode
298-
? Color.fromARGB(255, 220, 216, 216)
299-
: Color.fromARGB(255, 48, 46, 46),
302+
? TaskWarriorColors
303+
.kLightSecondaryBackgroundColor
304+
: TaskWarriorColors.ksecondaryBackgroundColor,
300305
),
301306
],
302307
),
@@ -307,11 +312,10 @@ class _FilterDrawerState extends State<FilterDrawer> {
307312
Container(
308313
width: 200,
309314
decoration: BoxDecoration(
310-
borderRadius: BorderRadius.circular(10),
311-
color: AppSettings.isDarkMode
312-
? Color.fromARGB(255, 220, 216, 216)
313-
: Color.fromARGB(255, 48, 46, 46),
314-
),
315+
borderRadius: BorderRadius.circular(10),
316+
color: AppSettings.isDarkMode
317+
? TaskWarriorColors.kLightSecondaryBackgroundColor
318+
: TaskWarriorColors.ksecondaryBackgroundColor),
315319
child: TextButton(
316320
onPressed: () {
317321
if (storageWidget.selectedSort.endsWith('+') ||
@@ -326,8 +330,8 @@ class _FilterDrawerState extends State<FilterDrawer> {
326330
style: GoogleFonts.poppins(
327331
fontSize: 15,
328332
color: AppSettings.isDarkMode
329-
? Color.fromARGB(255, 48, 46, 46)
330-
: Colors.white),
333+
? TaskWarriorColors.kLightSecondaryTextColor
334+
: TaskWarriorColors.ksecondaryTextColor),
331335
)),
332336
),
333337
const Divider(

lib/drawer/filter_drawer_tour.dart

Lines changed: 5 additions & 4 deletions
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/taskwarriorcolors.dart';
34
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
45

56
List<TargetFocus> filterDrawer({
@@ -31,7 +32,7 @@ List<TargetFocus> filterDrawer({
3132
"Filter tasks based on their completion status",
3233
textAlign: TextAlign.center,
3334
style: GoogleFonts.poppins(
34-
color: Colors.white,
35+
color: TaskWarriorColors.white,
3536
),
3637
),
3738
],
@@ -64,7 +65,7 @@ List<TargetFocus> filterDrawer({
6465
"Filter tasks based on the projects",
6566
textAlign: TextAlign.center,
6667
style: GoogleFonts.poppins(
67-
color: Colors.white,
68+
color: TaskWarriorColors.white,
6869
),
6970
),
7071
],
@@ -97,7 +98,7 @@ List<TargetFocus> filterDrawer({
9798
"Toggle between AND and OR tag union types",
9899
textAlign: TextAlign.center,
99100
style: GoogleFonts.poppins(
100-
color: Colors.white,
101+
color: TaskWarriorColors.white,
101102
),
102103
),
103104
],
@@ -130,7 +131,7 @@ List<TargetFocus> filterDrawer({
130131
"Sort tasks based on time of creation, urgency, due date, start date, etc.",
131132
textAlign: TextAlign.center,
132133
style: GoogleFonts.poppins(
133-
color: Colors.white,
134+
color: TaskWarriorColors.white,
134135
),
135136
),
136137
],

0 commit comments

Comments
 (0)