Flutter 带文本字段的颤振浮动操作按钮未完全位于键盘上方。需要像facebook一样的东西吗
我有一个奇怪的问题,我不知道如何解决。我使用TextField创建了一个自定义floatingActionButton,并将floatingActionButtonLocation设置为floatingActionButtonLocation.centerDocked。但是当文本字段被展开时,它会在键盘下面。有人能帮我解决这个问题吗Flutter 带文本字段的颤振浮动操作按钮未完全位于键盘上方。需要像facebook一样的东西吗,flutter,dart,textfield,floating-action-button,Flutter,Dart,Textfield,Floating Action Button,我有一个奇怪的问题,我不知道如何解决。我使用TextField创建了一个自定义floatingActionButton,并将floatingActionButtonLocation设置为floatingActionButtonLocation.centerDocked。但是当文本字段被展开时,它会在键盘下面。有人能帮我解决这个问题吗 Widget build(BuildContext context) { return Scaffold( appBar: GameDetai
Widget build(BuildContext context) {
return Scaffold(
appBar: GameDetailAppBar(
widget.model.selectedGame.name,
widget.model.selectedGame.currentUserMetadata['isOwner'],
widget.model),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: showGamePageBottomBar
? GamePageBottomBar(widget.model)
: _buildCommentBox(),
backgroundColor: Colors.white,
body: Container(
child: _buildGamePage(),
),
);
}
Widget _buildCommentBox() {
return Container(
margin: EdgeInsets.only(bottom: 55),
width: screenWidth(context),
color: Colors.white,
child: Container(
margin: EdgeInsets.only(top: 5, bottom: 5, right: 27, left: 27),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: createColor('#FFBF00'),
),
),
child: Padding(
padding: const EdgeInsets.only(left: 11, right: 11),
child: new TextFormField(
controller: _commentController,
// focusNode: commentFocusNode,
maxLines: 5,
minLines: 1,
decoration: new InputDecoration(
border: InputBorder.none,
suffix: Text(
'Post',
style: WidgetUtils.me.getLatoMedium(
16,
createColor('#0DB630'),
),
),
),
),
),
),
);
}
_buildCommentBox中的这个边距应该是在_commentController行上的动态basec。即使文本字段有一行,容器的空白部分也在键盘下
这是我的FloatingAction按钮在没有文本的情况下的外观:
当文本位于多行上时,需要修复此行为(在键盘下看不到底部边框):
这就是我想要的:
您应该看看这两种方法(我将链接到可能有助于您解决此问题的问题): 在
Scaffold
小部件()中使用resizetoavidobtompadding:true
)
或
使用
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom));
在填充
小部件上
()您应该看看这两种方法(我将链接到可能有助于解决此问题的问题): 在
Scaffold
小部件()中使用resizetoavidobtompadding:true
)
或
使用
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom));
在填充
小部件上
()使用滚动视图的最佳解决方案: 脚手架->底板
Scaffold(
bottomSheet: WIDGET,
)
使用滚动视图的最佳解决方案: 脚手架->底板
Scaffold(
bottomSheet: WIDGET,
)