@@ -4,19 +4,80 @@ import 'package:flutter/material.dart';
44import 'package:google_fonts/google_fonts.dart' ;
55
66import 'package:taskwarrior/config/app_settings.dart' ;
7+ import 'package:taskwarrior/controller/filter_drawer_tour_controller.dart' ;
8+ import 'package:taskwarrior/drawer/filter_drawer_tour.dart' ;
79import 'package:taskwarrior/model/storage/storage_widget.dart' ;
810import 'package:taskwarrior/views/home/home.dart' ;
911import 'package:taskwarrior/widgets/project_filter.dart' ;
1012import 'package:taskwarrior/widgets/tag_filter.dart' ;
13+ import 'package:tutorial_coach_mark/tutorial_coach_mark.dart' ;
1114
12- // ignore: must_be_immutable
13- class FilterDrawer extends StatelessWidget {
14- FilterDrawer (this .filters, {super .key});
15+ class FilterDrawer extends StatefulWidget {
16+ final Filters filters;
17+
18+ const FilterDrawer (this .filters, {super .key});
19+
20+ @override
21+ // ignore: library_private_types_in_public_api
22+ _FilterDrawerState createState () => _FilterDrawerState ();
23+ }
24+
25+ class _FilterDrawerState extends State <FilterDrawer > {
26+ final GlobalKey statusKey = GlobalKey ();
27+ final GlobalKey projectsKey = GlobalKey ();
28+ final GlobalKey filterTagKey = GlobalKey ();
29+ final GlobalKey sortByKey = GlobalKey ();
30+
31+ bool isSaved = false ;
1532 var tileColor = AppSettings .isDarkMode
1633 ? const Color .fromARGB (255 , 48 , 46 , 46 )
1734 : const Color .fromARGB (255 , 220 , 216 , 216 );
35+ late TutorialCoachMark tutorialCoachMark;
36+
37+ void _initFilterDrawerTour () {
38+ tutorialCoachMark = TutorialCoachMark (
39+ targets: filterDrawer (
40+ statusKey: statusKey,
41+ projectsKey: projectsKey,
42+ filterTagKey: filterTagKey,
43+ sortByKey: sortByKey,
44+ ),
45+ colorShadow: Colors .black,
46+ paddingFocus: 10 ,
47+ opacityShadow: 1.00 ,
48+ hideSkip: true ,
49+ onFinish: () {
50+ SaveFilterTour ().saveFilterTourStatus ();
51+ },
52+ );
53+ }
54+
55+ void _showFilterDrawerTour () {
56+ Future .delayed (
57+ const Duration (seconds: 2 ),
58+ () {
59+ SaveFilterTour ().getFilterTourStatus ().then ((value) => {
60+ if (value == false )
61+ {
62+ tutorialCoachMark.show (context: context),
63+ }
64+ else
65+ {
66+ // ignore: avoid_print
67+ print ('User has seen this page' ),
68+ }
69+ });
70+ },
71+ );
72+ }
73+
74+ @override
75+ void initState () {
76+ super .initState ();
77+ _initFilterDrawerTour ();
78+ _showFilterDrawerTour ();
79+ }
1880
19- final Filters filters;
2081 @override
2182 Widget build (BuildContext context) {
2283 var storageWidget = StorageWidget .of (context);
@@ -63,6 +124,7 @@ class FilterDrawer extends StatelessWidget {
63124 ),
64125 child: ListTile (
65126 title: RichText (
127+ key: statusKey,
66128 maxLines: 2 ,
67129 text: TextSpan (
68130 children: < TextSpan > [
@@ -77,7 +139,9 @@ class FilterDrawer extends StatelessWidget {
77139 ),
78140 ),
79141 TextSpan (
80- text: filters.pendingFilter ? 'pending' : 'completed' ,
142+ text: widget.filters.pendingFilter
143+ ? 'pending'
144+ : 'completed' ,
81145 style: GoogleFonts .poppins (
82146 fontSize: 15 ,
83147 color: AppSettings .isDarkMode
@@ -88,7 +152,7 @@ class FilterDrawer extends StatelessWidget {
88152 ],
89153 ),
90154 ),
91- onTap: filters.togglePendingFilter,
155+ onTap: widget. filters.togglePendingFilter,
92156 textColor: AppSettings .isDarkMode
93157 ? Colors .white
94158 : Color .fromARGB (255 , 48 , 46 , 46 ),
@@ -98,6 +162,7 @@ class FilterDrawer extends StatelessWidget {
98162 color: Color .fromARGB (0 , 48 , 46 , 46 ),
99163 ),
100164 Container (
165+ key: projectsKey,
101166 width: MediaQuery .of (context).size.width * 1 ,
102167 // padding: const EdgeInsets.all(12),
103168 decoration: BoxDecoration (
@@ -106,15 +171,16 @@ class FilterDrawer extends StatelessWidget {
106171 border: Border .all (color: Colors .grey.shade300),
107172 ),
108173 child: ProjectsColumn (
109- filters.projects,
110- filters.projectFilter,
111- filters.toggleProjectFilter,
174+ widget. filters.projects,
175+ widget. filters.projectFilter,
176+ widget. filters.toggleProjectFilter,
112177 ),
113178 ),
114179 const Divider (
115180 color: Color .fromARGB (0 , 48 , 46 , 46 ),
116181 ),
117182 Container (
183+ key: filterTagKey,
118184 width: MediaQuery .of (context).size.width * 1 ,
119185 padding: const EdgeInsets .all (12 ),
120186 decoration: BoxDecoration (
@@ -146,7 +212,7 @@ class FilterDrawer extends StatelessWidget {
146212 ),
147213 Padding (
148214 padding: const EdgeInsets .symmetric (horizontal: 8.0 ),
149- child: TagFiltersWrap (filters.tagFilters),
215+ child: TagFiltersWrap (widget. filters.tagFilters),
150216 ),
151217 const Divider (
152218 color: Color .fromARGB (0 , 48 , 46 , 46 ),
@@ -158,6 +224,7 @@ class FilterDrawer extends StatelessWidget {
158224 color: Color .fromARGB (0 , 48 , 46 , 46 ),
159225 ),
160226 Container (
227+ key: sortByKey,
161228 width: MediaQuery .of (context).size.width * 1 ,
162229 padding: const EdgeInsets .all (12 ),
163230 decoration: BoxDecoration (
0 commit comments