fix changing search target in search result page

This commit is contained in:
2024-11-07 09:02:03 +08:00
parent 5d43f5c556
commit 5a14ea48c1

View File

@@ -42,7 +42,7 @@ class _SearchResultPageState extends State<SearchResultPage> {
void search([String? text]) { void search([String? text]) {
if (text != null) { if (text != null) {
if(suggestionsController.entry != null) { if (suggestionsController.entry != null) {
suggestionsController.remove(); suggestionsController.remove();
} }
setState(() { setState(() {
@@ -135,20 +135,24 @@ class _SearchResultPageState extends State<SearchResultPage> {
onChanged: onChanged, onChanged: onChanged,
action: buildAction(), action: buildAction(),
), ),
loadPage: source!.searchPageData!.loadPage == null ? null : (i) { loadPage: source!.searchPageData!.loadPage == null
return source.searchPageData!.loadPage!( ? null
text, : (i) {
i, return source.searchPageData!.loadPage!(
options, text,
); i,
}, options,
loadNext: source.searchPageData!.loadNext == null ? null : (i) { );
return source.searchPageData!.loadNext!( },
text, loadNext: source.searchPageData!.loadNext == null
i, ? null
options, : (i) {
); return source.searchPageData!.loadNext!(
}, text,
i,
options,
);
},
); );
} }
@@ -424,6 +428,11 @@ class _SearchSettingsDialogState extends State<_SearchSettingsDialog> {
setState(() { setState(() {
searchTarget = e.key; searchTarget = e.key;
options.clear(); options.clear();
final searchOptions = ComicSource.find(searchTarget)!
.searchPageData!
.searchOptions ??
<SearchOptions>[];
options = searchOptions.map((e) => e.defaultValue).toList();
onChanged(); onChanged();
}); });
}, },