[英]i want my bottom widget to push on top when keyboard focused
i want my bottom widget to push on top when keyboard focused because it hide the the bottom widget please help me how can i resolve and i have some more widgets but i want to my bottom widget to show up on screen我希望我的底部小部件在键盘聚焦时推到顶部,因为它隐藏了底部小部件请帮助我如何解决,我还有一些小部件,但我希望我的底部小部件显示在屏幕上
body: Column(
children: [
Container(
color: Colors.black,
height: MediaQuery.of(context).size.height * 0.6,
),
Container(
padding: EdgeInsets.fromLTRB(10, 20, 10, 0),
height: MediaQuery.of(context).size.height * 0.4,
child: Column(
children: [
Column(
children: [
Align(),
Padding()
Container(),
SizedBox(height: 20),
Container(),
SizedBox(height: 20),
GestureDetector(),
SizedBox(height: 15),
Text.rich(
TextSpan(),
),
],
),
],
),
)
],
),
You can include resizeToAvoidBottomInset:true
it is will shrink the size on keyboard appear(default).您可以包括
resizeToAvoidBottomInset:true
它会缩小键盘出现的大小(默认)。
If you use resizeToAvoidBottomInset: false,
wrap the body with scollable widget.如果您使用
resizeToAvoidBottomInset: false,
请使用可缩放小部件包裹主体。 like喜欢
body: SingleChildScrollView( child: Column(...
To check keyboard visibility, you can check flutter_keyboard_visibility and and use a scrollController to move bottom.要检查键盘可见性,您可以检查flutter_keyboard_visibility并使用滚动控制器来移动底部。
return KeyboardVisibilityBuilder(
builder: (context, isKeyboardVisible) {
if (isKeyboardVisible){
controller.animateTo(
controller.position.maxScrollExtent,
curve: Curves.bounceIn,
duration: Duration(milliseconds: 100)
);
}
return ListView(
controller: controller,
),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.