+
This commit is contained in:
parent
34f31e6cb7
commit
e57102b981
3 changed files with 34 additions and 19 deletions
|
|
@ -116,9 +116,22 @@ class $SelectFilter implements SelectFilter, $Instance {
|
|||
args[0]!.$value,
|
||||
args[1]!.$value,
|
||||
args[2]!.$value,
|
||||
(args[3]!.$value as List)
|
||||
.map((e) => SelectFilterOption(e.$reified.name, e.$reified.value))
|
||||
.toList(),
|
||||
(args[3]!.$value as List).map((e) {
|
||||
if (e is $Value) {
|
||||
final value = e.$reified;
|
||||
if (value is Map) {
|
||||
Map<String, dynamic> map = {};
|
||||
map = value.map((key, value) => MapEntry(key.toString(), value));
|
||||
if (map['type'] == 'SelectOption') {
|
||||
final filter = map['filter'] as Map;
|
||||
return SelectFilterOption.fromJson(
|
||||
filter.map((key, value) => MapEntry(key.toString(), value)));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return e;
|
||||
}).toList(),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ class SelectFilterOption {
|
|||
String value;
|
||||
|
||||
SelectFilterOption(this.name, this.value);
|
||||
|
||||
factory SelectFilterOption.fromJson(Map<String, dynamic> json) {
|
||||
return SelectFilterOption(json['name'], json['value']);
|
||||
}
|
||||
}
|
||||
|
||||
class SeparatorFilter {
|
||||
|
|
@ -61,17 +65,12 @@ class TriStateFilter {
|
|||
int state;
|
||||
|
||||
factory TriStateFilter.fromJson(Map<String, dynamic> json) {
|
||||
return TriStateFilter(json['type'], json['name'], json['value']);
|
||||
return TriStateFilter(json['type'], json['name'], json['value'],
|
||||
state: json['state'] ?? 0);
|
||||
}
|
||||
TriStateFilter(this.type, this.name, this.value, {this.state = 0});
|
||||
}
|
||||
|
||||
extension TriStateFilterExtension on TriStateFilter {
|
||||
bool get ignored => state == 0;
|
||||
bool get included => state == 1;
|
||||
bool get excluded => state == 2;
|
||||
}
|
||||
|
||||
class GroupFilter {
|
||||
String? type;
|
||||
String name;
|
||||
|
|
@ -85,8 +84,10 @@ class CheckBoxFilter {
|
|||
String name;
|
||||
String value;
|
||||
bool state;
|
||||
|
||||
factory CheckBoxFilter.fromJson(Map<String, dynamic> json) {
|
||||
return CheckBoxFilter(json['type'], json['name'], json['value']);
|
||||
return CheckBoxFilter(json['type'], json['name'], json['value'],
|
||||
state: json['state'] ?? false);
|
||||
}
|
||||
CheckBoxFilter(this.type, this.name, this.value, {this.state = false});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,14 +252,15 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
}),
|
||||
);
|
||||
if (result == 'filter') {
|
||||
setState(() {
|
||||
_query = '';
|
||||
_textEditingController.clear();
|
||||
_selectedIndex = 2;
|
||||
_isFiltering = true;
|
||||
_isSearch = true;
|
||||
_page = 1;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_selectedIndex = 2;
|
||||
_isFiltering = true;
|
||||
_isSearch = true;
|
||||
_page = 1;
|
||||
});
|
||||
}
|
||||
|
||||
_getManga = ref.refresh(searchProvider(
|
||||
source: widget.source,
|
||||
query: _query,
|
||||
|
|
|
|||
Loading…
Reference in a new issue