11import 'package:double_back_to_close_app/double_back_to_close_app.dart' ;
22import 'package:flutter/material.dart' ;
3-
43import 'package:get/get.dart' ;
54import 'package:taskwarrior/app/modules/home/views/show_tasks.dart' ;
6-
75import 'package:taskwarrior/app/modules/home/views/tasks_builder.dart' ;
86import 'package:taskwarrior/app/utils/constants/palette.dart' ;
97import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart' ;
108import 'package:taskwarrior/app/utils/app_settings/app_settings.dart' ;
11-
129import '../controllers/home_controller.dart' ;
1310
1411class HomePageBody extends StatelessWidget {
@@ -19,106 +16,145 @@ class HomePageBody extends StatelessWidget {
1916 Widget build (BuildContext context) {
2017 controller.initInAppTour ();
2118 controller.showInAppTour (context);
22- return DoubleBackToCloseApp (
23- snackBar: const SnackBar (content: Text ('Tap back again to exit' )),
24- child: Container (
25- color: AppSettings .isDarkMode
26- ? Palette .kToDark.shade200
27- : TaskWarriorColors .white,
28- child: Padding (
29- padding: const EdgeInsets .only (left: 8.0 , right: 8.0 ),
30- child: Obx (
31- () => Column (
32- children: < Widget > [
33- if (controller.searchVisible.value)
34- Container (
35- margin: const EdgeInsets .symmetric (
36- horizontal: 10 , vertical: 10 ),
37- child: SearchBar (
38- backgroundColor: WidgetStateProperty .all <Color >(
39- (TaskWarriorColors .kLightPrimaryBackgroundColor)),
40- surfaceTintColor: WidgetStateProperty .all <Color >(
41- (TaskWarriorColors .kLightPrimaryBackgroundColor)),
42- controller: controller.searchController,
43- // shape:,
44- onChanged: (value) {
45- controller.search (value);
46- },
47-
48- shape: WidgetStateProperty .resolveWith <OutlinedBorder ?>(
49- (Set <WidgetState > states) {
50- if (states.contains (WidgetState .focused)) {
51- return RoundedRectangleBorder (
52- borderRadius: BorderRadius .circular (12.0 ),
53- side: BorderSide (
54- color: TaskWarriorColors .black,
55- width: 2.0 ,
56- ),
57- );
58- } else {
59- return RoundedRectangleBorder (
60- borderRadius: BorderRadius .circular (12.0 ),
61- side: BorderSide (
62- color: TaskWarriorColors .black,
63- width: 1.5 ,
64- ),
65- );
66- }
67- },
19+ return Scaffold (
20+ drawer: Drawer (
21+ // Add your drawer content here
22+ child: ListView (
23+ padding: EdgeInsets .zero,
24+ children: const < Widget > [
25+ DrawerHeader (
26+ decoration: BoxDecoration (
27+ color: Colors .blue,
28+ ),
29+ child: Text (
30+ 'Drawer Header' ,
31+ style: TextStyle (
32+ color: Colors .white,
33+ fontSize: 24 ,
34+ ),
35+ ),
36+ ),
37+ ListTile (
38+ leading: Icon (Icons .message),
39+ title: Text ('Messages' ),
40+ ),
41+ ListTile (
42+ leading: Icon (Icons .account_circle),
43+ title: Text ('Profile' ),
44+ ),
45+ ListTile (
46+ leading: Icon (Icons .settings),
47+ title: Text ('Settings' ),
48+ ),
49+ ],
50+ ),
51+ ),
52+ body: GestureDetector (
53+ onHorizontalDragEnd: (details) {
54+ if (details.primaryVelocity! > 0 ) {
55+ Scaffold .of (context).openDrawer ();
56+ }
57+ },
58+ child: DoubleBackToCloseApp (
59+ snackBar: const SnackBar (content: Text ('Tap back again to exit' )),
60+ child: Container (
61+ color: AppSettings .isDarkMode
62+ ? Palette .kToDark.shade200
63+ : TaskWarriorColors .white,
64+ child: Padding (
65+ padding: const EdgeInsets .only (left: 8.0 , right: 8.0 ),
66+ child: Obx (
67+ () => Column (
68+ children: < Widget > [
69+ if (controller.searchVisible.value)
70+ Container (
71+ margin: const EdgeInsets .symmetric (
72+ horizontal: 10 , vertical: 10 ),
73+ child: SearchBar (
74+ backgroundColor: WidgetStateProperty .all <Color >(
75+ (TaskWarriorColors .kLightPrimaryBackgroundColor)),
76+ surfaceTintColor: WidgetStateProperty .all <Color >(
77+ (TaskWarriorColors .kLightPrimaryBackgroundColor)),
78+ controller: controller.searchController,
79+ onChanged: (value) {
80+ controller.search (value);
81+ },
82+ shape:
83+ WidgetStateProperty .resolveWith <OutlinedBorder ?>(
84+ (Set <WidgetState > states) {
85+ if (states.contains (WidgetState .focused)) {
86+ return RoundedRectangleBorder (
87+ borderRadius: BorderRadius .circular (12.0 ),
88+ side: BorderSide (
89+ color: TaskWarriorColors .black,
90+ width: 2.0 ,
91+ ),
92+ );
93+ } else {
94+ return RoundedRectangleBorder (
95+ borderRadius: BorderRadius .circular (12.0 ),
96+ side: BorderSide (
97+ color: TaskWarriorColors .black,
98+ width: 1.5 ,
99+ ),
100+ );
101+ }
102+ },
103+ ),
104+ leading: const Icon (Icons .search_rounded),
105+ trailing: < Widget > [
106+ (controller.searchController.text.isNotEmpty)
107+ ? IconButton (
108+ key: GlobalKey (),
109+ icon: Icon (Icons .cancel,
110+ color: TaskWarriorColors .black),
111+ onPressed: () {
112+ controller.searchController.clear ();
113+ controller.search (
114+ controller.searchController.text);
115+ },
116+ )
117+ : const SizedBox (
118+ width: 0 ,
119+ height: 0 ,
120+ )
121+ ],
122+ hintText: 'Search' ,
123+ ),
68124 ),
69- leading: const Icon (Icons .search_rounded),
70- trailing: < Widget > [
71- (controller.searchController.text.isNotEmpty)
72- ? IconButton (
73- key: GlobalKey (),
74- icon: Icon (Icons .cancel,
75- color: TaskWarriorColors .black),
76- onPressed: () {
77- controller.searchController.clear ();
78- controller
79- .search (controller.searchController.text);
80- },
81- )
82- : const SizedBox (
83- width: 0 ,
84- height: 0 ,
85- )
86- ],
87-
88- hintText: 'Search' ,
89- ),
90- ),
91- Visibility (
92- visible: ! controller.taskchampion.value,
93- child: Expanded (
94- child: Scrollbar (
95- child: Obx (
96- () => TasksBuilder (
97- // darkmode: AppSettings.isDarkMode,
98- useDelayTask: controller.useDelayTask.value,
99- taskData: controller.searchedTasks,
100- pendingFilter: controller.pendingFilter.value,
101- waitingFilter: controller.waitingFilter.value,
102- searchVisible: controller.searchVisible.value,
103- selectedLanguage: controller.selectedLanguage.value,
104- scrollController: controller.scrollController,
105- showbtn: controller.showbtn.value,
125+ Visibility (
126+ visible: ! controller.taskchampion.value,
127+ child: Expanded (
128+ child: Scrollbar (
129+ child: Obx (
130+ () => TasksBuilder (
131+ useDelayTask: controller.useDelayTask.value,
132+ taskData: controller.searchedTasks,
133+ pendingFilter: controller.pendingFilter.value,
134+ waitingFilter: controller.waitingFilter.value,
135+ searchVisible: controller.searchVisible.value,
136+ selectedLanguage:
137+ controller.selectedLanguage.value,
138+ scrollController: controller.scrollController,
139+ showbtn: controller.showbtn.value,
140+ ),
141+ ),
106142 ),
107143 ),
108144 ),
109- ),
145+ Visibility (
146+ visible: controller.taskchampion.value,
147+ child: Expanded (
148+ child: Scrollbar (
149+ child: TaskViewBuilder (
150+ pendingFilter: controller.pendingFilter.value,
151+ selectedSort: controller.selectedSort.value,
152+ project: controller.projectFilter.value,
153+ ),
154+ )))
155+ ],
110156 ),
111- Visibility (
112- visible: controller.taskchampion.value,
113- child: Expanded (
114- child: Scrollbar (
115- child: TaskViewBuilder (
116- pendingFilter: controller.pendingFilter.value,
117- selectedSort: controller.selectedSort.value,
118- project: controller.projectFilter.value,
119- ),
120- )))
121- ],
157+ ),
122158 ),
123159 ),
124160 ),
0 commit comments