diff --git a/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt deleted file mode 100644 index 25aab2f..0000000 --- a/android/app/src/main/kotlin/com/example/mobile_requester_app/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package nexus.federated.nexus - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() diff --git a/android/app/src/main/kotlin/nexus/federated/nexus/MainActivity.kt b/android/app/src/main/kotlin/nexus/federated/nexus/MainActivity.kt new file mode 100644 index 0000000..a243e36 --- /dev/null +++ b/android/app/src/main/kotlin/nexus/federated/nexus/MainActivity.kt @@ -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(FLUTTER_VIEW_ID) ?: return + val insets = view.rootWindowInsets ?: return + view.onApplyWindowInsets(insets) + } +} diff --git a/lib/controllers/app_paused.dart b/lib/controllers/app_paused.dart index 25b77ca..09a5b0a 100644 --- a/lib/controllers/app_paused.dart +++ b/lib/controllers/app_paused.dart @@ -5,7 +5,6 @@ class AppPausedController extends Notifier { @override bool build() { final listener = AppLifecycleListener( - onHide: () => FocusManager.instance.primaryFocus?.unfocus(), onPause: () => state = true, onResume: () => state = false, );