简体   繁体   English

我希望我的底部小部件在键盘聚焦时推到顶部

[英]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.

相关问题 当 TextField 或 TextFormField 获得焦点时,在 flutter 中将屏幕底部推到键盘顶部 - Push screen bottom on top of keyboard in flutter when TextField or TextFormField is focused Flutter:显示键盘时的底部小部件 - Flutter: bottom widget when keyboard is displayed 为什么我的小部件在我使用键盘时重建 - Why does my widget rebuild when I use keyboard 从底部自动滚动到小部件顶部选择文本时的可滚动 SelectableText - Scrollable SelectableText when selecting text from bottom autoscrolls to top of widget 当它出现时,有没有办法将小部件推到键盘上方? - Is there any way to push Widget above of the Keyboard when it shows up? 我想将行放在屏幕底部,用展开的小部件包裹它不起作用 - I want to place row at the bottom of the screen wrapping it with expanded widget is not working 将 OverlayEntry 小部件推送到键盘上方 - Push OverlayEntry Widget above keyboard 无论底部的另一个小部件如何,当键盘弹出时,将包含小部件的 TextField 移动到可查看区域 - Move TextField containing widget to view-able area when keyboard pop up regardless of another widget in the bottom 我想在所有情况下都隐藏我的键盘 - I want to hide my keyboard in all situations 导航到下一页时,如何从下到上为下一页设置动画 - How can I animate my next page from bottom to top when I navigate to it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM