0
点赞
收藏
分享

微信扫一扫

flutter解决键盘遮挡TextField

googlefrank 2022-02-03 阅读 73
flutter

Scaffold有一个属性resizeToAvoidBottomInset,默认为true,配合SingleChildScrollView可实现自适应键盘高度


class Demo extends StatelessWidget {
  const Demo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: true, //默认为true,可不写
      appBar: AppBar(
        title: const Text("Demo"),
      ),
      body: SingleChildScrollView(
        child: Column(),
      ),
    );
  }
}
举报

相关推荐

0 条评论