fix keyboard selection issue
This commit is contained in:
+8
-2
@@ -364,13 +364,19 @@ class SearchScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
useOnAppLifecycleStateChange((previous, current) {
|
useOnAppLifecycleStateChange((previous, current) {
|
||||||
switch (current) {
|
switch (current) {
|
||||||
case AppLifecycleState.detached:
|
|
||||||
case AppLifecycleState.inactive:
|
|
||||||
case AppLifecycleState.hidden:
|
case AppLifecycleState.hidden:
|
||||||
case AppLifecycleState.paused:
|
case AppLifecycleState.paused:
|
||||||
//Fixes issue with disappearing keyboard after resume (even we request focus)
|
//Fixes issue with disappearing keyboard after resume (even we request focus)
|
||||||
searchFocusNode.unfocus();
|
searchFocusNode.unfocus();
|
||||||
pauseTime.value ??= DateTime.now();
|
pauseTime.value ??= DateTime.now();
|
||||||
|
case AppLifecycleState.inactive:
|
||||||
|
case AppLifecycleState.detached:
|
||||||
|
// Transient focus loss (IME input-method picker via long-press
|
||||||
|
// spacebar, notification shade, split-screen) reports `inactive`
|
||||||
|
// while the field is still visible. Unfocusing here would tear down
|
||||||
|
// the input connection and dismiss the keyboard/picker, so leave
|
||||||
|
// focus untouched and only react to genuine backgrounding above.
|
||||||
|
break;
|
||||||
case AppLifecycleState.resumed:
|
case AppLifecycleState.resumed:
|
||||||
if (pauseTime.value == null ||
|
if (pauseTime.value == null ||
|
||||||
DateTime.now().difference(pauseTime.value!) <
|
DateTime.now().difference(pauseTime.value!) <
|
||||||
|
|||||||
Reference in New Issue
Block a user