Skip to content

Commit 9a9d90d

Browse files
committed
feat(feed): show filter indicator on icon
- Added visual filter indicator - Show when filter is applied
1 parent 7030a97 commit 9a9d90d

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,44 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
6969
appBar: AppBar(
7070
title: const Text('Headlines Feed'),
7171
actions: [
72-
IconButton(
73-
icon: const Icon(Icons.filter_list),
74-
onPressed: () {
75-
final bloc = context.read<HeadlinesFeedBloc>();
76-
showModalBottomSheet<void>(
77-
context: context,
78-
builder: (BuildContext context) {
79-
return _HeadlinesFilterBottomSheet(
80-
bloc: bloc,
81-
);
82-
},
72+
BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
73+
builder: (context, state) {
74+
bool isFilterApplied = false;
75+
if (state is HeadlinesFeedLoaded) {
76+
isFilterApplied = state.filter.category != null ||
77+
state.filter.source != null ||
78+
state.filter.eventCountry != null;
79+
}
80+
return Stack(
81+
children: [
82+
IconButton(
83+
icon: const Icon(Icons.filter_list),
84+
onPressed: () {
85+
final bloc = context.read<HeadlinesFeedBloc>();
86+
showModalBottomSheet<void>(
87+
context: context,
88+
builder: (BuildContext context) {
89+
return _HeadlinesFilterBottomSheet(
90+
bloc: bloc,
91+
);
92+
},
93+
);
94+
},
95+
),
96+
if (isFilterApplied)
97+
Positioned(
98+
top: 8,
99+
right: 8,
100+
child: Container(
101+
width: 8,
102+
height: 8,
103+
decoration: BoxDecoration(
104+
color: Theme.of(context).colorScheme.primary,
105+
shape: BoxShape.circle,
106+
),
107+
),
108+
),
109+
],
83110
);
84111
},
85112
),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ht_main
22
description: main headlines toolkit mobile app.
3-
version: 0.11.5
3+
version: 0.13.0
44
publish_to: none
55
repository: https://github.com/headlines-toolkit/ht-main
66
environment:

0 commit comments

Comments
 (0)