fix search, locale

This commit is contained in:
nyne
2024-10-28 08:57:29 +08:00
parent 001b94866d
commit 467dacdf79
3 changed files with 31 additions and 8 deletions

View File

@@ -42,10 +42,14 @@ class _SearchResultPageState extends State<SearchResultPage> {
void search([String? text]) {
if (text != null) {
if(suggestionsController.entry != null) {
suggestionsController.remove();
}
setState(() {
this.text = text;
});
appdata.addSearchHistory(text);
controller.currentText = text;
}
}
@@ -80,10 +84,18 @@ class _SearchResultPageState extends State<SearchResultPage> {
}
}
@override
void dispose() {
Future.microtask(() {
suggestionsController.remove();
});
super.dispose();
}
@override
void initState() {
controller = SearchBarController(
initialText: widget.text,
currentText: widget.text,
onSearch: search,
);
sourceKey = widget.sourceKey;