【发布时间】:2021-04-06 21:02:17
【问题描述】:
我在底部导航栏中有一个文本字段。我正在制作一个聊天屏幕,所以当用户点击文本字段时,键盘会向上,但文本字段会向下并且不向上。我尝试了很多解决方案,但没有任何效果,我真的被困住了。 颤振版本
颤振 1.26.0-1.0.pre
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Palette.primary,
appBar: MyAppBar(),
body: MyBody(),
bottomNavigationBar: TextField(
maxLength: 255,
decoration: InputDecoration(
hintText: " write here",
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
border: null,
hintStyle: GoogleFonts.getFont('Tajawal',
color: Colors.white, fontWeight: FontWeight.w500),
counterText: "",
),
style: GoogleFonts.getFont('Tajawal',
fontSize: 17, fontWeight: FontWeight.w500),
),
),
);
}
}
【问题讨论】:
-
用
Stack小部件包裹您的文本字段并将对齐设置为底部并删除resizeToAvoidBottomInset: false,, -
@AR 谢谢你,但没用。
-
发生了什么?
-
没什么,和截图一样。
-
从底部导航栏中删除文本字段并添加到正文中
标签: flutter dart navigation keyboard bottom