当文本字段聚焦时,内容在 iOS 中向上滚动,但在 android 中不起作用。我是否需要更改小部件的层次结构或需要更改 AndroidManifest 文件中的某些配置?我也尝试过 Scaffold 的 resizeToAvoidBottomInset 和 resizeToAvoidBottomPadding 属性
Widget build(BuildContext context) {
return Scaffold(
body: Container(
margin: EdgeInsets.all(0.0),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/background.png"),
fit: BoxFit.fill),
),
child: Stack(
children: <Widget>[
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: signUpCardView,
),
),
userLogin(bloc),
],
),
),
);
}
Widget get signUpCardView {
return SingleChildScrollView(
child: Card(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(vertical: 30.0),
child: Center(
child: Column(
children: <Widget>[
Text(
"${AppTranslations.of(context).text("signUp")}",
style: TextStyle(
color: AppColors.BUTTON_SECONDARY_BACKGROUND_COLOR,
fontFamily: customFontFamily,
fontSize: 30.0,
),
),
SizedBox(
width: 50,
height: 20,
child: Divider(
thickness: 4.0,
color: AppColors.BUTTON_SECONDARY_BACKGROUND_COLOR,
),
)
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0.0),
child: nameField(bloc),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0.0),
child: mobileField(bloc),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0.0),
child: emailField(bloc),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0.0),
child: passwordField(bloc),
),
confirmPasswordField(bloc),
Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: submitButton(bloc),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Center(
child: Padding(
padding: const EdgeInsets.only(bottom: 50.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"${AppTranslations.of(context).text("alreadyHaveAnAccount")}?",
style: TextStyle(
color: Colors.grey.shade600,
fontFamily: customFontFamily,
),
),
InkWell(
onTap: () {
_openSignInScreen();
},
child: Text(
" ${AppTranslations.of(context).text("signIn")}",
style: TextStyle(
color: AppColors.BUTTON_SECONDARY_BACKGROUND_COLOR,
fontFamily: customFontFamily,
),
),
),
],
),
),
),
),
],
),
),
);
}
This is the UI
最佳答案
要使屏幕“调整大小”,即移动到光标,您的 android list 中应该包含以下内容:
<application
...
<activity
...
android:windowSoftInputMode="adjustResize"
关于android - Flutter 键盘在 android 中隐藏文本字段,但在 iOS 中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61227116/