@@ -69,17 +69,44 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
69
69
appBar: AppBar (
70
70
title: const Text ('Headlines Feed' ),
71
71
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
+ ],
83
110
);
84
111
},
85
112
),
0 commit comments