attempt another fix for keyboard issues
This commit is contained in:
parent
9b03ce4549
commit
1a4d391a6c
3 changed files with 19 additions and 6 deletions
|
|
@ -1,5 +0,0 @@
|
||||||
package nexus.federated.nexus
|
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
|
||||||
|
|
||||||
class MainActivity: FlutterActivity()
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package nexus.federated.nexus
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
class MainActivity: FlutterActivity() {
|
||||||
|
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||||
|
super.onWindowFocusChanged(hasFocus)
|
||||||
|
if (!hasFocus) return
|
||||||
|
|
||||||
|
// Flutter swallows inset updates while it thinks a keyboard animation is
|
||||||
|
// running, and only stops when the animation ends. If the app is
|
||||||
|
// backgrounded mid-animation, it can miss the end and keep the keyboard's
|
||||||
|
// space reserved, so hand the view the real insets directly.
|
||||||
|
val view = findViewById<View>(FLUTTER_VIEW_ID) ?: return
|
||||||
|
val insets = view.rootWindowInsets ?: return
|
||||||
|
view.onApplyWindowInsets(insets)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ class AppPausedController extends Notifier<bool> {
|
||||||
@override
|
@override
|
||||||
bool build() {
|
bool build() {
|
||||||
final listener = AppLifecycleListener(
|
final listener = AppLifecycleListener(
|
||||||
onHide: () => FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
onPause: () => state = true,
|
onPause: () => state = true,
|
||||||
onResume: () => state = false,
|
onResume: () => state = false,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue