filterChipsButtons method

dynamic filterChipsButtons()

Implementation

Widget filterChipsButtons() {
  final lang = L10n.of(context);
  final selected = ref.watch(
    roomListFilterProvider.select((value) => value.selection),
  );
  return Container(
    padding: const EdgeInsets.all(10),
    child: Wrap(
      children: [
        FilterChip(
          selected: selected == FilterSelection.all,
          label: Text(lang.all),
          onSelected: (value) async {
            final notifier = ref.read(roomListFilterProvider.notifier);
            await notifier.setSelection(FilterSelection.all);
          },
        ),
        const SizedBox(width: 10),
        FilterChip(
          selected: selected == FilterSelection.favorites,
          label: Text(lang.bookmarked),
          onSelected: (value) async {
            final notifier = ref.read(roomListFilterProvider.notifier);
            await notifier.setSelection(FilterSelection.favorites);
          },
        ),
        const SizedBox(width: 10),
        FilterChip(
          selected: selected == FilterSelection.dmsOnly,
          label: Text(lang.dms),
          onSelected: (value) async {
            final notifier = ref.read(roomListFilterProvider.notifier);
            await notifier.setSelection(FilterSelection.dmsOnly);
          },
        ),
        const SizedBox(width: 10),
      ],
    ),
  );
}