Я создаю экран входа в систему для приложения Android TV. Макет-это двухколонный панель (слева: QR, справа: форма электронной почты/пароль). Когда появляется клавиатура на экране, поле электронной почты остается видимым над клавиатурой, но поле Password (которое ниже) перекрывается/скрыто клавиатурой. Как я могу сохранить сфокусированное поле видимым на Android TV? мой макет телевизора.
Соответствующий код (упрощенный):
Код: Выделить всё
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: Column(
children: [
_showTopBar(),
Expanded(
child: Center(
child: Stack(
children: [
_showForm(),
_showCircularProgress(),
],
),
),
),
],
),
);
}
Widget _showForm() {
return Column(
children: [
Expanded(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
child: Container(
child: Column(
children: [
// ... left column (QR) and divider ...
// Right: email/password column
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Center(
child: Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("Login with Email"),
SizedBox(height: 20),
showEmailInput(), // TextFormField with focusNode _emailFocus
SizedBox(height: 16),
showPasswordInput(), // TextFormField with focusNode _passwordFocus
SizedBox(height: 24),
showPrimaryButton(),
],
),
),
),
),
),
],
),
),
),
),
),
],
);
}
Widget showEmailInput() => TextFormField(
keyboardType: TextInputType.emailAddress,
focusNode: _emailFocus,
onFieldSubmitted: (_) {
_emailFocus.unfocus();
FocusScope.of(context).requestFocus(_passwordFocus);
},
...
);
Widget showPasswordInput() => TextFormField(
obscureText: true,
focusNode: _passwordFocus,
...
);
- Flutter на Android TV
- . (VISE-Eversa) Внутри каркаса сборки виджета
- Добавление SingleChildScrollview и установить физическое свойство в BouncingScrollphysics
Подробнее здесь: https://stackoverflow.com/questions/797 ... tformfield