【问题标题】:Flutter : background is squeezed to the left when keyboard shows upFlutter:当键盘出现时背景被挤压到左边
【发布时间】:2021-03-03 18:39:19
【问题描述】:

当我想填充 TextView 并且键盘出现时,脚手架向左挤压时遇到问题。

有人知道吗?

这是我的代码:

  @override
  Widget build(BuildContext context) {

    final authentCubit = context.watch<AuthentificationCubit>();
    final UserRepository user = UserRepository();
    print(user.getUserName());
    return Scaffold(

      resizeToAvoidBottomPadding: false,
      appBar: AppBar(
        title: Text('First Route'),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            ElevatedButton(
              child: Text('Deconnexion'),
              onPressed: () {
                authentCubit.signOut();
              },
            ),
            ElevatedButton(
              child: Text('Formulaire contact'),
              onPressed: () {
                showDialog(context: context,builder: (context)=> ContactForm());
              },
            ),
            TextField(),
          ],
        ),
      ),
    );
  }


}

这是我的问题的屏幕

谢谢

【问题讨论】:

  • 我已经在真实设备中测试了您的代码,并且运行良好。可以在真机或其他模拟器上试用吗?
  • 感谢您的回答。我已经回答了这个问题

标签: flutter keyboard resize scaffold


【解决方案1】:

我的树中有两个脚手架,这就是“resizeToAvoidBottomPadding: false”不起作用的原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-06
    • 2021-01-05
    • 2014-09-23
    • 2015-07-20
    • 1970-01-01
    相关资源
    最近更新 更多