@@ -57,7 +57,7 @@ class FilterSheet extends StatelessWidget {
5757 mainAxisSize: MainAxisSize .min,
5858 children: [
5959 Container (
60- color: const Color ( 0xFFF3F4F7 ) ,
60+ color: AppColors .grey7 ,
6161 child: Row (
6262 mainAxisAlignment: MainAxisAlignment .spaceBetween,
6363 children: < Widget > [
@@ -73,7 +73,7 @@ class FilterSheet extends StatelessWidget {
7373 TextButton (
7474 onPressed: () {
7575 context.read <ContestsBloc >().saveFilter ();
76- Get .back ();
76+ Get .back (result : true );
7777 },
7878 child: Text (
7979 'Apply' ,
@@ -105,7 +105,7 @@ class FilterSheet extends StatelessWidget {
105105 return _buildPlatfromIcon (
106106 platfromIcons[index],
107107 () {
108- final updatedPlatform = state.filter! .platform! ;
108+ final updatedPlatform = state.filter! .platform;
109109 updatedPlatform[index] = ! updatedPlatform[index];
110110 context.read <ContestsBloc >().add (
111111 UpdateFilter (
@@ -115,7 +115,7 @@ class FilterSheet extends StatelessWidget {
115115 ),
116116 );
117117 },
118- state.filter! .platform! [index],
118+ state.filter! .platform[index],
119119 );
120120 },
121121 ),
@@ -183,11 +183,17 @@ class FilterSheet extends StatelessWidget {
183183 ),
184184 ),
185185 ),
186- Row (
187- children: < Widget > [
188- GestureDetector (
189- onTap: () {},
190- child: Padding (
186+ GestureDetector (
187+ onTap: () {
188+ final ongoing = state.filter! .ongoing! ;
189+ context.read <ContestsBloc >().add (UpdateFilter (
190+ updatedFilter: state.filter! .copyWith (
191+ ongoing: ! ongoing,
192+ )));
193+ },
194+ child: Row (
195+ children: < Widget > [
196+ Padding (
191197 padding: const EdgeInsets .fromLTRB (25 , 10 , 15 , 10 ),
192198 child: SvgPicture .asset (
193199 state.filter! .ongoing!
@@ -197,74 +203,85 @@ class FilterSheet extends StatelessWidget {
197203 width: 28 ,
198204 ),
199205 ),
200- ),
201- GestureDetector (
202- onTap: () {},
203- child: const Text (
206+ const Text (
204207 'Ongoing' ,
205208 style: TextStyle (
206209 fontSize: 16 ,
207210 ),
208211 ),
209- )
210- ] ,
212+ ],
213+ ) ,
211214 ),
212- Row (
213- children: < Widget > [
214- GestureDetector (
215- onTap: () {},
216- child: Padding (
217- padding: const EdgeInsets .fromLTRB (25 , 10 , 15 , 10 ),
218- child: SvgPicture .asset (
219- state.filter! .upcoming!
220- ? AppAssets .trueRadioButton
221- : AppAssets .falseRadioButton,
222- height: 28 ,
223- width: 28 ,
215+ GestureDetector (
216+ onTap: () {
217+ final upcoming = state.filter! .upcoming! ;
218+ context.read <ContestsBloc >().add (UpdateFilter (
219+ updatedFilter: state.filter! .copyWith (
220+ upcoming: ! upcoming,
221+ startDate: ! upcoming ? DateTime .now () : null ,
222+ )));
223+ },
224+ child: Row (
225+ children: < Widget > [
226+ Padding (
227+ padding: const EdgeInsets .fromLTRB (25 , 10 , 15 , 10 ),
228+ child: SvgPicture .asset (
229+ state.filter! .upcoming!
230+ ? AppAssets .trueRadioButton
231+ : AppAssets .falseRadioButton,
232+ height: 28 ,
233+ width: 28 ,
234+ ),
235+ ),
236+ const Text (
237+ 'Upcoming' ,
238+ style: TextStyle (
239+ fontSize: 16 ,
240+ ),
241+ ),
242+ TextButton (
243+ onPressed: () async {
244+ showDatePicker (
245+ builder: (BuildContext context, Widget ? child) {
246+ return Theme (
247+ data: Theme .of (context).copyWith (
248+ colorScheme:
249+ const ColorScheme .light ().copyWith (
250+ primary: AppColors .primary,
251+ ),
252+ ),
253+ child: child! ,
254+ );
255+ },
256+ context: context,
257+ initialDate: DateTime .now (),
258+ firstDate: DateTime (2020 ),
259+ lastDate: DateTime (2025 ),
260+ ).then ((val) {
261+ context.read <ContestsBloc >().add (UpdateFilter (
262+ updatedFilter: state.filter! .copyWith (
263+ upcoming: true ,
264+ startDate: val ?? = DateTime .now (),
265+ ),
266+ ));
267+ });
268+ },
269+ child: Container (
270+ margin: const EdgeInsets .symmetric (horizontal: 15 ),
271+ padding: const EdgeInsets .all (5 ),
272+ decoration: BoxDecoration (
273+ borderRadius: BorderRadius .circular (5 ),
224274 ),
225- )),
226- GestureDetector (
227- onTap: () {},
228- child: const Text (
229- 'Upcoming' ,
230- style: TextStyle (
231- fontSize: 16 ,
275+ child: Text (
276+ (state.filter! .startDate != null )
277+ ? DateFormat ('d MMMM, yyyy' )
278+ .format (state.filter! .startDate! )
279+ : 'Select Date' ,
232280 ),
233- )),
234- TextButton (
235- onPressed: () async {
236- showDatePicker (
237- builder: (BuildContext context, Widget ? child) {
238- return Theme (
239- data: Theme .of (context).copyWith (
240- colorScheme: const ColorScheme .light ().copyWith (
241- primary: AppColors .primary,
242- ),
243- ),
244- child: child! ,
245- );
246- },
247- context: context,
248- initialDate: DateTime .now (),
249- firstDate: DateTime (2020 ),
250- lastDate: DateTime (2025 ),
251- ).then ((val) {});
252- },
253- child: Container (
254- margin: const EdgeInsets .symmetric (horizontal: 15 ),
255- padding: const EdgeInsets .all (5 ),
256- decoration: BoxDecoration (
257- borderRadius: BorderRadius .circular (5 ),
258- ),
259- child: Text (
260- (state.filter! .startDate != null )
261- ? DateFormat ('d MMMM, yyyy' )
262- .format (state.filter! .startDate! )
263- : 'Select Date' ,
264281 ),
265282 ),
266- ) ,
267- ] ,
283+ ] ,
284+ ) ,
268285 ),
269286 ],
270287 ),
0 commit comments