mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-06-20 18:08:04 +00:00
SearchFix Assisted-By:Gemini
This commit is contained in:
parent
2cc8d2620d
commit
5f94461071
@ -59,6 +59,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
|
||||
void onSubmitted(String value) {
|
||||
ref.read(searchTermStateProvider.notifier).state = value;
|
||||
focusNode.unfocus();
|
||||
if (value.trim().isEmpty) {
|
||||
return;
|
||||
}
|
||||
@ -127,19 +128,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
)
|
||||
.toList();
|
||||
|
||||
return KeyboardListener(
|
||||
focusNode: focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (value) {
|
||||
final isEnter = value.logicalKey ==
|
||||
LogicalKeyboardKey.enter;
|
||||
|
||||
if (isEnter) {
|
||||
onSubmitted(controller.text);
|
||||
focusNode.unfocus();
|
||||
}
|
||||
},
|
||||
child: AutoComplete(
|
||||
return AutoComplete(
|
||||
suggestions: suggestions.length <= 2
|
||||
? [
|
||||
...suggestions,
|
||||
@ -153,6 +142,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
features: [
|
||||
const InputFeature.leading(
|
||||
Icon(SpotubeIcons.search),
|
||||
@ -182,7 +172,6 @@ class SearchPage extends HookConsumerWidget {
|
||||
placeholder: Text(context.l10n.search),
|
||||
onSubmitted: onSubmitted,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user