attempt another fix for keyboard issues

This commit is contained in:
Henry Hiles 2026-10-20 14:27:35 -04:00
commit 1a4d391a6c
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
3 changed files with 19 additions and 6 deletions

View file

@ -1,5 +0,0 @@
package nexus.federated.nexus
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()

View file

@ -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)
}
}

View file

@ -5,7 +5,6 @@ class AppPausedController extends Notifier<bool> {
@override
bool build() {
final listener = AppLifecycleListener(
onHide: () => FocusManager.instance.primaryFocus?.unfocus(),
onPause: () => state = true,
onResume: () => state = false,
);