Skip to content

Commit deef4c1

Browse files
authored
Merge pull request #186 from Pavel401/fix-filter
Fixed the project filter
2 parents 228a58f + f4bc0a6 commit deef4c1

File tree

2 files changed

+123
-64
lines changed

2 files changed

+123
-64
lines changed

lib/drawer/filter_drawer.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class FilterDrawer extends StatelessWidget {
5454
color: Color.fromARGB(0, 48, 46, 46),
5555
),
5656
Container(
57-
width: MediaQuery.of(context).size.width * 1,
58-
padding: const EdgeInsets.all(12),
57+
// width: MediaQuery.of(context).size.width * 1,
58+
// padding: const EdgeInsets.all(12),
5959
decoration: BoxDecoration(
6060
color: tileColor,
6161
borderRadius: BorderRadius.circular(8),
@@ -99,7 +99,7 @@ class FilterDrawer extends StatelessWidget {
9999
),
100100
Container(
101101
width: MediaQuery.of(context).size.width * 1,
102-
padding: const EdgeInsets.all(12),
102+
// padding: const EdgeInsets.all(12),
103103
decoration: BoxDecoration(
104104
color: tileColor,
105105
borderRadius: BorderRadius.circular(8),

lib/widgets/project_filter.dart

Lines changed: 120 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -42,61 +42,94 @@ class ProjectsColumn extends StatelessWidget {
4242
@override
4343
Widget build(BuildContext context) {
4444
return InheritedProjects(
45-
projectFilter: projectFilter,
46-
callback: callback,
47-
projects: projects,
48-
child: ExpansionTile(
49-
key: const PageStorageKey('project-filter'),
50-
title: RichText(
51-
maxLines: 2,
52-
text: TextSpan(
53-
children: <TextSpan>[
54-
TextSpan(
55-
text: 'Project : ',
56-
style: GoogleFonts.firaMono(
57-
fontWeight: FontWeight.bold,
58-
fontSize: 15,
59-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
60-
),
45+
projectFilter: projectFilter,
46+
callback: callback,
47+
projects: projects,
48+
child: Column(
49+
children: [
50+
Padding(
51+
padding: const EdgeInsets.all(10.0),
52+
child: Row(
53+
mainAxisAlignment: MainAxisAlignment.center,
54+
crossAxisAlignment: CrossAxisAlignment.center,
55+
children: [
56+
Text(
57+
"Project : ",
58+
style: GoogleFonts.firaMono(
59+
fontWeight: FontWeight.bold,
60+
fontSize: 15,
61+
color:
62+
AppSettings.isDarkMode ? Colors.white : Colors.black,
63+
),
64+
),
65+
SizedBox(
66+
width: 40.w,
67+
child: SingleChildScrollView(
68+
scrollDirection: Axis.horizontal,
69+
child: Row(
70+
mainAxisAlignment: MainAxisAlignment.center,
71+
crossAxisAlignment: CrossAxisAlignment.center,
72+
children: [
73+
Text(
74+
projectFilter == ""
75+
? "Not selected"
76+
: projectFilter,
77+
style: GoogleFonts.firaMono(
78+
fontSize: 12,
79+
color: AppSettings.isDarkMode
80+
? Colors.white
81+
: Colors.black,
82+
),
83+
),
84+
],
85+
),
86+
),
87+
),
88+
],
6189
),
62-
TextSpan(
63-
text: projectFilter,
64-
style: GoogleFonts.firaMono(
65-
fontSize: 15,
66-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
67-
),
90+
),
91+
Padding(
92+
padding: const EdgeInsets.only(left: 10, right: 10, top: 10),
93+
child: Row(
94+
mainAxisAlignment: MainAxisAlignment.center,
95+
children: [
96+
Text(
97+
"All Projecs",
98+
style: GoogleFonts.firaMono(
99+
fontWeight: FontWeight.w600,
100+
fontSize: 12,
101+
color:
102+
AppSettings.isDarkMode ? Colors.white : Colors.black,
103+
),
104+
),
105+
],
68106
),
69-
],
70-
),
71-
),
72-
backgroundColor: AppSettings.isDarkMode
73-
? const Color.fromARGB(255, 48, 46, 46)
74-
: const Color.fromARGB(255, 220, 216, 216),
75-
iconColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
76-
collapsedIconColor:
77-
AppSettings.isDarkMode ? Colors.white : Colors.black,
78-
children: projects.isNotEmpty
79-
? (Map.of(projects)
80-
..removeWhere((_, nodeData) => nodeData.parent != null))
81-
.keys
82-
.map(ProjectTile.new)
83-
.toList()
84-
: [
85-
Text(
86-
"No Projecs Found",
87-
style: TextStyle(
88-
color: (AppSettings.isDarkMode
107+
),
108+
if (projects.isNotEmpty)
109+
...projects.entries
110+
.where((entry) => entry.value.parent == null)
111+
.map((entry) => ProjectTile(entry.key))
112+
.toList()
113+
else
114+
Column(
115+
children: [
116+
Text(
117+
"No Projects Found",
118+
style: TextStyle(
119+
color: AppSettings.isDarkMode
89120
? Colors.white
90-
: const Color.fromARGB(255, 48, 46, 46)),
121+
: const Color.fromARGB(255, 48, 46, 46),
91122
fontFamily: GoogleFonts.firaMono().fontFamily,
92-
fontSize: 14),
93-
),
94-
SizedBox(
95-
height: 2.h,
96-
)
97-
],
98-
),
99-
);
123+
fontSize: 14,
124+
),
125+
),
126+
SizedBox(
127+
height: 2.h,
128+
),
129+
],
130+
),
131+
],
132+
));
100133
}
101134
}
102135

@@ -145,19 +178,45 @@ class ProjectTile extends StatelessWidget {
145178
);
146179

147180
return (node.children.isEmpty)
148-
? ListTile(
149-
leading: radio,
150-
title: title,
181+
? GestureDetector(
151182
onTap: () => callback(project),
152-
tileColor: AppSettings.isDarkMode
153-
? const Color.fromARGB(255, 48, 46, 46)
154-
: const Color.fromARGB(255, 220, 216, 216),
155-
textColor: AppSettings.isDarkMode
156-
? Colors.white
157-
: const Color.fromARGB(255, 48, 46, 46),
183+
child: Row(
184+
children: [
185+
radio,
186+
SizedBox(
187+
width: 45.w,
188+
child: Text(project,
189+
maxLines: 3,
190+
style: GoogleFonts.firaMono(
191+
color: AppSettings.isDarkMode
192+
? Colors.white
193+
: Colors.black)),
194+
),
195+
const SizedBox(
196+
width: 5,
197+
),
198+
Container(
199+
padding: const EdgeInsets.all(4),
200+
decoration: BoxDecoration(
201+
color: (AppSettings.isDarkMode
202+
? Colors.white
203+
: const Color.fromARGB(255, 48, 46, 46)),
204+
),
205+
child: Text(
206+
(node.children.isEmpty)
207+
? '${node.subtasks}'
208+
: '(${node.tasks}) ${node.subtasks}',
209+
maxLines: 1,
210+
style: GoogleFonts.firaMono(
211+
color: AppSettings.isDarkMode
212+
? Colors.black
213+
: Colors.white),
214+
),
215+
),
216+
],
217+
),
158218
)
159219
: ExpansionTile(
160-
// textColor: Theme.of(context).textTheme.subtitle1!.color,
161220
controlAffinity: ListTileControlAffinity.leading,
162221
leading: radio,
163222
title: title,

0 commit comments

Comments
 (0)