Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BlocBuilder<CategoryFilterBloc, CategoryFilterState>(
- builder: (context, state) {
- return Wrap(
- alignment: WrapAlignment.start,
- spacing: 8,
- runSpacing: 0,
- children: _valueFilterLocation
- .map(
- (location) => ChoiceChip(
- selected:
- state.selectedLocation.contains(location),
- onSelected: (bool selected) {
- if (selected == true) {
- context
- .read<CategoryFilterBloc>()
- .add(OnSelectedLocation(location));
- } else if (selected == false) {
- context
- .read<CategoryFilterBloc>()
- .add(UnSelectedLocation(location));
- }
- print(state.selectedLocation);
- },
- padding: const EdgeInsets.symmetric(
- horizontal: 4,
- ),
- selectedColor:
- state.selectedLocation.contains(location)
- ? AppColors.orangeLight
- : Colors.white,
- backgroundColor: Colors.white,
- shape: const StadiumBorder(
- side: BorderSide(
- color: Colors.grey,
- width: 1,
- ),
- ),
- label: Text(
- location,
- style: GoogleFonts.roboto(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: state.selectedLocation
- .contains(location)
- ? Colors.white
- : Colors.grey,
- ),
- ),
- ),
- )
- .toList(),
- );
- },
- ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement