-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(filters): Added job offer list filter modal
- Loading branch information
1 parent
f927e07
commit afd46b6
Showing
4 changed files
with
154 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
lib/job_offer_list/dialog/job_offer_list_filter_dialog.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:fudeo_hackaton/job_offer_list/bloc/job_offer_list_bloc.dart'; | ||
import 'package:fudeo_hackaton/job_offer_list/widget/filters/dialog/filter_group.dart'; | ||
import 'package:fudeo_hackaton/theme/buttons.dart'; | ||
import 'package:fudeo_hackaton/theme/colors.dart'; | ||
import 'package:fudeo_hackaton/theme/fonts.dart'; | ||
import 'package:phosphor_flutter/phosphor_flutter.dart'; | ||
|
||
class JobOfferListFilterDialog extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return BlocBuilder<JobOfferListBloc, JobOfferListState>( | ||
builder: (context, state) { | ||
if (state is! OpportunityFilterEditing) { | ||
return const ColoredBox( | ||
color: AppColors.accentLight, | ||
child: Center( | ||
child: CircularProgressIndicator(), | ||
), | ||
); | ||
} | ||
return ColoredBox( | ||
color: AppColors.accentLight, | ||
child: Padding( | ||
padding: const EdgeInsets.all(24), | ||
child: Column( | ||
children: [ | ||
Expanded( | ||
child: SingleChildScrollView( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
BackButton( | ||
onPressed: () => _cancelFilter(context), | ||
), | ||
const Text( | ||
'Filtri', | ||
style: AppFonts.filtersDialogTitle, | ||
), | ||
TextButton( | ||
onPressed: () => _resetFilter(context), | ||
child: const Text( | ||
'Reset', | ||
style: AppFonts.filtersDialogButton, | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 12), | ||
FilterGroup( | ||
title: 'Team', | ||
icon: PhosphorIcons.regular.users, | ||
filters: const [ | ||
Filter.fullRemote, | ||
Filter.hybrid, | ||
Filter.onSite, | ||
], | ||
), | ||
FilterGroup( | ||
title: 'Seniority', | ||
icon: PhosphorIcons.regular.code, | ||
filters: const [ | ||
Filter.junior, | ||
Filter.mid, | ||
Filter.senior, | ||
], | ||
), | ||
FilterGroup( | ||
title: 'Contratto', | ||
icon: PhosphorIcons.regular.clock, | ||
filters: const [ | ||
Filter.fullTime, | ||
Filter.partTime, | ||
], | ||
), | ||
], | ||
), | ||
), | ||
), | ||
AppButton( | ||
action: () => _applyFilter(context), | ||
text: 'Applica filtri', | ||
iconData: PhosphorIcons.regular.check, | ||
), | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
|
||
static Future<void> show(BuildContext context, JobOfferListBloc bloc) { | ||
final size = MediaQuery.of(context).size; | ||
return showModalBottomSheet<void>( | ||
isScrollControlled: true, | ||
constraints: BoxConstraints( | ||
maxHeight: size.height * 0.9, | ||
), | ||
isDismissible: false, | ||
context: context, | ||
builder: (context) => | ||
BlocProvider.value(value: bloc, child: JobOfferListFilterDialog()), | ||
); | ||
} | ||
|
||
Future<void> _applyFilter(BuildContext context) async { | ||
Navigator.of(context).pop(); | ||
BlocProvider.of<JobOfferListBloc>(context).add(ApplyFilterTap()); | ||
} | ||
|
||
void _cancelFilter(BuildContext context) { | ||
Navigator.of(context).pop(); | ||
BlocProvider.of<JobOfferListBloc>(context).add(CancelFilterTap()); | ||
} | ||
|
||
void _resetFilter(BuildContext context) { | ||
Navigator.of(context).pop(); | ||
BlocProvider.of<JobOfferListBloc>(context).add(EmptyFilterTap()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters