@@ -6,6 +6,8 @@ import 'package:lotti/blocs/journal/journal_page_state.dart';
6
6
import 'package:lotti/widgets/search/entry_type_filter.dart' ;
7
7
import 'package:lotti/widgets/search/search_widget.dart' ;
8
8
import 'package:lotti/widgets/search/task_status_filter.dart' ;
9
+ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart' ;
10
+ import 'package:wolt_modal_sheet/wolt_modal_sheet.dart' ;
9
11
10
12
class JournalSliverAppBar extends StatelessWidget {
11
13
const JournalSliverAppBar ({
@@ -20,9 +22,8 @@ class JournalSliverAppBar extends StatelessWidget {
20
22
final showTasks = snapshot.showTasks;
21
23
22
24
return SliverAppBar (
23
- expandedHeight: showTasks ? null : 230 ,
24
25
pinned: true ,
25
- toolbarHeight: showTasks ? 100 : 200 ,
26
+ toolbarHeight: 100 ,
26
27
title: Column (
27
28
children: [
28
29
const SizedBox (height: 10 ),
@@ -39,11 +40,9 @@ class JournalSliverAppBar extends StatelessWidget {
39
40
),
40
41
),
41
42
if (showTasks) const TaskFilterIcon (),
43
+ if (! showTasks) const JournalFilterIcon (),
42
44
],
43
45
),
44
- if (! showTasks) const JournalFilter (),
45
- const SizedBox (height: 10 ),
46
- if (! showTasks) const EntryTypeFilter (),
47
46
],
48
47
),
49
48
);
@@ -117,3 +116,91 @@ class JournalFilter extends StatelessWidget {
117
116
);
118
117
}
119
118
}
119
+
120
+ const double _pagePadding = 16 ;
121
+ const double _pageBreakpoint = 768 ;
122
+
123
+ class JournalFilterIcon extends StatelessWidget {
124
+ const JournalFilterIcon ({super .key});
125
+
126
+ @override
127
+ Widget build (BuildContext context) {
128
+ final pageIndexNotifier = ValueNotifier (0 );
129
+
130
+ SliverWoltModalSheetPage page1 (
131
+ BuildContext modalSheetContext,
132
+ TextTheme textTheme,
133
+ ) {
134
+ return WoltModalSheetPage (
135
+ hasSabGradient: false ,
136
+ topBarTitle: Text ('Entries Filter' , style: textTheme.titleSmall),
137
+ isTopBarLayerAlwaysVisible: true ,
138
+ trailingNavBarWidget: IconButton (
139
+ padding: const EdgeInsets .all (_pagePadding),
140
+ icon: const Icon (Icons .close),
141
+ onPressed: Navigator .of (modalSheetContext).pop,
142
+ ),
143
+ child: const Padding (
144
+ padding: EdgeInsets .only (
145
+ bottom: 30 ,
146
+ left: 10 ,
147
+ top: 10 ,
148
+ right: 10 ,
149
+ ),
150
+ child: Column (
151
+ children: [
152
+ JournalFilter (),
153
+ SizedBox (height: 10 ),
154
+ EntryTypeFilter (),
155
+ ],
156
+ ),
157
+ ),
158
+ );
159
+ }
160
+
161
+ return Padding (
162
+ padding: const EdgeInsets .only (right: 30 ),
163
+ child: IconButton (
164
+ onPressed: () {
165
+ WoltModalSheet .show <void >(
166
+ pageIndexNotifier: pageIndexNotifier,
167
+ context: context,
168
+ pageListBuilder: (modalSheetContext) {
169
+ final textTheme = Theme .of (context).textTheme;
170
+ return [
171
+ page1 (modalSheetContext, textTheme),
172
+ ];
173
+ },
174
+ decorator: (child) {
175
+ return MultiBlocProvider (
176
+ providers: [
177
+ BlocProvider .value (
178
+ value: context.read <JournalPageCubit >(),
179
+ ),
180
+ ],
181
+ child: child,
182
+ );
183
+ },
184
+ modalTypeBuilder: (context) {
185
+ final size = MediaQuery .of (context).size.width;
186
+ if (size < _pageBreakpoint) {
187
+ return WoltModalType .bottomSheet;
188
+ } else {
189
+ return WoltModalType .dialog;
190
+ }
191
+ },
192
+ onModalDismissedWithBarrierTap: () {
193
+ debugPrint ('Closed modal sheet with barrier tap' );
194
+ Navigator .of (context).pop ();
195
+ },
196
+ maxDialogWidth: 560 ,
197
+ minDialogWidth: 400 ,
198
+ minPageHeight: 0 ,
199
+ maxPageHeight: 0.9 ,
200
+ );
201
+ },
202
+ icon: Icon (MdiIcons .filterVariant),
203
+ ),
204
+ );
205
+ }
206
+ }
0 commit comments