【问题标题】:i want my bottom widget to push on top when keyboard focused我希望我的底部小部件在键盘聚焦时推到顶部
【发布时间】:2022-08-17 19:52:44
【问题描述】:

我希望我的底部小部件在键盘聚焦时推到顶部,因为它隐藏了底部小部件请帮助我如何解决,我还有一些小部件,但我希望我的底部小部件显示在屏幕上

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(),
                ),
              ],
            ),
          ],
        ),
      )
    ],
  ),

    标签: flutter


    【解决方案1】:

    您可以包含resizeToAvoidBottomInset:true 它会缩小键盘出现的大小(默认)。

    如果你使用 resizeToAvoidBottomInset: false, 用可滚动的小部件包裹身体。喜欢

    body: SingleChildScrollView( child:  Column(...
    

    【讨论】:

      猜你喜欢
      • 2020-11-22
      • 2021-08-01
      • 1970-01-01
      • 2019-05-04
      • 2022-01-04
      • 2021-02-24
      • 2018-09-17
      • 2021-05-29
      • 1970-01-01
      相关资源
      最近更新 更多