#50 settings: scrollable hidden filter list
This commit is contained in:
parent
3709e0cb07
commit
3a2e0349e2
1 changed files with 59 additions and 40 deletions
|
@ -40,52 +40,71 @@ class HiddenFilterPage extends StatelessWidget {
|
||||||
title: Text(context.l10n.settingsHiddenFiltersTitle),
|
title: Text(context.l10n.settingsHiddenFiltersTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Selector<Settings, Set<CollectionFilter>>(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
selector: (context, s) => settings.hiddenFilters,
|
||||||
children: [
|
builder: (context, hiddenFilters, child) {
|
||||||
Padding(
|
if (hiddenFilters.isEmpty) {
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
return Column(
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Icon(AIcons.info),
|
const _Header(),
|
||||||
const SizedBox(width: 16),
|
const Divider(),
|
||||||
Expanded(child: Text(context.l10n.settingsHiddenFiltersBanner)),
|
Expanded(
|
||||||
],
|
child: Padding(
|
||||||
),
|
padding: const EdgeInsets.all(8),
|
||||||
),
|
child: EmptyContent(
|
||||||
const Divider(),
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
child: Selector<Settings, Set<CollectionFilter>>(
|
|
||||||
selector: (context, s) => settings.hiddenFilters,
|
|
||||||
builder: (context, hiddenFilters, child) {
|
|
||||||
if (hiddenFilters.isEmpty) {
|
|
||||||
return EmptyContent(
|
|
||||||
icon: AIcons.hide,
|
icon: AIcons.hide,
|
||||||
text: context.l10n.settingsHiddenFiltersEmpty,
|
text: context.l10n.settingsHiddenFiltersEmpty,
|
||||||
);
|
),
|
||||||
}
|
),
|
||||||
final filterList = hiddenFilters.toList()..sort();
|
),
|
||||||
return Wrap(
|
],
|
||||||
spacing: 8,
|
);
|
||||||
runSpacing: 8,
|
}
|
||||||
children: filterList
|
|
||||||
.map((filter) => AvesFilterChip(
|
final filterList = hiddenFilters.toList()..sort();
|
||||||
filter: filter,
|
return ListView(
|
||||||
removable: true,
|
children: [
|
||||||
onTap: (filter) => context.read<CollectionSource>().changeFilterVisibility(filter, true),
|
const _Header(),
|
||||||
onLongPress: null,
|
const Divider(),
|
||||||
))
|
Padding(
|
||||||
.toList(),
|
padding: const EdgeInsets.all(8),
|
||||||
);
|
child: Wrap(
|
||||||
},
|
spacing: 8,
|
||||||
|
runSpacing: 8,
|
||||||
|
children: filterList
|
||||||
|
.map((filter) => AvesFilterChip(
|
||||||
|
filter: filter,
|
||||||
|
removable: true,
|
||||||
|
onTap: (filter) => context.read<CollectionSource>().changeFilterVisibility(filter, true),
|
||||||
|
onLongPress: null,
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _Header extends StatelessWidget {
|
||||||
|
const _Header({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(AIcons.info),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(child: Text(context.l10n.settingsHiddenFiltersBanner)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue