Skip to content

Commit a34b2ee

Browse files
committed
Fixed filter view
1 parent 1817b35 commit a34b2ee

File tree

3 files changed

+83
-64
lines changed

3 files changed

+83
-64
lines changed

flutter_module/lib/presentation/screens/main_screen.dart

+70-62
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ class _MainPage extends HookConsumerWidget {
7777
return Scaffold(
7878
backgroundColor: ColorStyles.pageBackground(),
7979
body: ViewStateWrapper<List<Snippet>>(
80-
isLoading: state == ModelState.loading || stateNotification.isLoading == true,
80+
isLoading:
81+
state == ModelState.loading || stateNotification.isLoading == true,
8182
error: stateNotification.error,
8283
data: stateNotification.data?.cast(),
8384
builder: (_, snippets) {
@@ -114,14 +115,15 @@ class _MainPage extends HookConsumerWidget {
114115
typedef ExpandChangeListener = Function(bool);
115116

116117
class _MainPageData extends HookWidget {
117-
const _MainPageData(
118-
{required this.navigator,
119-
required this.model,
120-
required this.snippets,
121-
required this.filter,
122-
required this.controller,
123-
required this.expanded,
124-
required this.onExpandChange});
118+
const _MainPageData({
119+
required this.navigator,
120+
required this.model,
121+
required this.snippets,
122+
required this.filter,
123+
required this.controller,
124+
required this.expanded,
125+
required this.onExpandChange,
126+
});
125127

126128
final DetailsNavigator navigator;
127129
final ChannelMainModel model;
@@ -165,65 +167,71 @@ class _MainPageData extends HookWidget {
165167
],
166168
),
167169
SliverAppBar(
168-
floating: true,
169-
forceElevated: true,
170-
expandedHeight: Dimens.extendedAppBarHeight,
171-
elevation: Dimens.s / 2,
172-
backgroundColor: ColorStyles.surfacePrimary(),
173-
shape: const RoundedRectangleBorder(
174-
borderRadius: BorderRadius.only(
175-
bottomLeft: Radius.circular(Dimens.l),
176-
bottomRight: Radius.circular(Dimens.l),
177-
),
170+
floating: true,
171+
forceElevated: true,
172+
expandedHeight: Dimens.extendedAppBarHeight,
173+
elevation: Dimens.s / 2,
174+
backgroundColor: ColorStyles.surfacePrimary(),
175+
shape: const RoundedRectangleBorder(
176+
borderRadius: BorderRadius.only(
177+
bottomLeft: Radius.circular(Dimens.l),
178+
bottomRight: Radius.circular(Dimens.l),
178179
),
179-
flexibleSpace: FlexibleSpaceBar(
180-
collapseMode: CollapseMode.parallax,
181-
background: Padding(
182-
padding: const EdgeInsets.symmetric(horizontal: Dimens.m),
183-
child: Column(
184-
mainAxisAlignment: MainAxisAlignment.end,
185-
children: [
186-
PaddingStyles.small(
187-
Row(children: [TextStyles.bold("Scope")]),
188-
),
189-
PaddingStyles.small(
190-
Row(
191-
children: [
192-
Expanded(
193-
child: SizedBox(
194-
height: Dimens.filterDropdownHeight,
195-
child: FilterDropdown(
196-
filters: filter.scopes ?? List.empty(),
197-
selected: filter.selectedScope ?? '',
198-
onSelected: (scope) {
199-
model.filterScope(scope);
200-
},
201-
),
180+
),
181+
flexibleSpace: FlexibleSpaceBar(
182+
collapseMode: CollapseMode.parallax,
183+
background: Padding(
184+
padding: const EdgeInsets.symmetric(horizontal: Dimens.m),
185+
child: Column(
186+
mainAxisAlignment: MainAxisAlignment.end,
187+
children: [
188+
PaddingStyles.small(
189+
Row(children: [TextStyles.bold("Scope")]),
190+
),
191+
PaddingStyles.small(
192+
Row(
193+
children: [
194+
Expanded(
195+
child: SizedBox(
196+
height: Dimens.filterDropdownHeight,
197+
child: FilterDropdown(
198+
filters: filter.scopes ?? List.empty(),
199+
selected: filter.selectedScope ?? '',
200+
onSelected: (scope) {
201+
model.filterScope(scope);
202+
},
202203
),
203204
),
204-
],
205-
),
205+
),
206+
const SizedBox(width: Dimens.xl),
207+
const Icon(
208+
Icons.favorite_border,
209+
color: Colors.black,
210+
),
211+
],
206212
),
207-
PaddingStyles.small(
208-
Row(children: [TextStyles.bold("Language")]),
209-
),
210-
SizedBox(
211-
height: Dimens.filterListHeight,
212-
child: FilterListView(
213-
filters: filter.languages ?? List.empty(),
214-
selected: filter.selectedLanguages ?? List.empty(),
215-
onSelected: (language, isSelected) {
216-
model.filterLanguage(language, isSelected);
217-
},
218-
),
213+
),
214+
PaddingStyles.small(
215+
Row(children: [TextStyles.bold("Language")]),
216+
),
217+
SizedBox(
218+
height: Dimens.filterListHeight,
219+
child: FilterListView(
220+
filters: filter.languages ?? List.empty(),
221+
selected: filter.selectedLanguages ?? List.empty(),
222+
onSelected: (language, isSelected) {
223+
model.filterLanguage(language, isSelected);
224+
},
219225
),
220-
const SizedBox(
221-
height: Dimens.m,
222-
)
223-
],
224-
),
226+
),
227+
const SizedBox(
228+
height: Dimens.m,
229+
)
230+
],
225231
),
226-
))
232+
),
233+
),
234+
)
227235
];
228236
},
229237
body: CustomScrollView(

flutter_module/lib/presentation/styles/dimens.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Dimens {
88
static const inputBorderWidth = 1.0;
99
static const filterDropdownHeight = 24.0;
1010
static const filterListHeight = 48.0;
11-
static const extendedAppBarHeight = 144.0;
11+
static const extendedAppBarHeight = 120.0;
1212

1313
static const logoSignetSize = 18.0;
1414
}

flutter_module/lib/presentation/widgets/snippet_list_item.dart

+12-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,18 @@ class SnippetListTile extends HookWidget {
3434
right: Dimens.l,
3535
bottom: Dimens.m,
3636
),
37-
child: TextStyles.title(snippet.title ?? ""),
37+
child: Row(
38+
children: [
39+
Expanded(child: TextStyles.title(snippet.title ?? "")),
40+
const SizedBox(width: Dimens.s),
41+
Icon(
42+
snippet.isFavorite == true
43+
? Icons.favorite
44+
: Icons.favorite_border,
45+
size: Dimens.l,
46+
),
47+
],
48+
),
3849
),
3950
Ink(
4051
color: ColorStyles.codeBackground(),

0 commit comments

Comments
 (0)