I am experiencing a critical issue where the soft keyboard immediately dismisses (within ~200ms) after a user taps a TextField. This prevents any text input and effectively blocks the user flow.
The Bug:
User taps the
TextField.The keyboard begins to animate up.
Before completing the animation, the keyboard "bounces" and closes automatically.
The
TextFieldloses focus immediately.
Devices & OS Versions Affected:
vivo X300 / Motorola Edge 50 Pro: Android 16 Beta (API 36)
OnePlus 11: OxygenOS 16.0.3.500
realme 9 Pro+: Android 14 (showing similar regression)
Technical Context: This appears to be related to the mandatory Edge-to-Edge enforcement in Android 16. As the keyboard resizes the window, the "Window Inset" transition seems to trigger a layout collision or a "pointer cancel" event that Flutter interprets as a request to unfocus.
What I have tried:
Defining
TextEditingControllerandFocusNodeininitState(to prevent rebuild-related focus loss).Setting
resizeToAvoidBottomInset: trueon theScaffold.Wrapping the input area in a
SafeAreaandSingleChildScrollView.Testing both
adjustResizeandadjustPanin theAndroidManifest.xml.Removing background
GestureDetectorsto rule out accidentalunfocus()calls.
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: LoginScreen()));
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State createState() => _LoginScreenState();
}
class _LoginScreenState extends State {
final FocusNode _focusNode = FocusNode();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: 300), // Push field toward bottom
TextField(
focusNode: _focusNode,
decoration: const InputDecoration(hintText: "Enter Mobile Number"),
),
],
),
),
),
);
}
}