微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

FloatingActionButton列焦点时与文本字段重叠

如何解决FloatingActionButton列焦点时与文本字段重叠

我在顶部有一个文本小部件。 后面跟着一个文本框。 与顶部的 2 个小部件不同,底部小部件是位于脚手架内的 FAB,而不是主体。

我意识到对于 FAB 中的一列,它会自动将自己定位到顶部。我通过放入一个垫片来解决它。

1.有没有更好的办法解决

附上我的代码。运行它将显示我想要的理想布局。但是,当文本字段被聚焦并出现键盘时,FAB 会变得太高并与文本字段重叠。问题仅发生在 FAB 列上,而不发生在 FAB 的单个按钮上。

我只希望 FAB 位于文本字段下方和键盘上方。有足够的空间。

2.当焦点在文本字段上时,如何让 FAB 出现在文本字段的正下方?

附上问题图片

FAB overlaps textfield when textfield in focus

Scaffold(
      floatingActionButton: Column(
        children: <Widget>[
          Spacer(),Container(
            height: height * 0.057,width: width * 0.93,child: RawMaterialButton(
              onpressed: () {},shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(7.5))),fillColor: Color(0xff0074e0),child: Text(
                'Report',style: TextStyle(
                    fontSize: 18,),RawMaterialButton(
              onpressed: () {},child: Text(
                'Cancel',color: Color(0xff0074e0),)),extendBody: true,floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,backgroundColor: Colors.black,body: Center(
                  child: Padding(
                padding: EdgeInsets.symmetric(horizontal: width * 0.03),child: Column(children: <Widget>[
                  Padding(
                    padding: EdgeInsets.only(
                        top: height * 0.06,bottom: height * 0.003),child: Text('Keep Your Space Safe',style: TextStyle(
                          fontSize: 30,Container(
                    margin: EdgeInsets.only(
                        left: width * 0.15,right: width * 0.15,bottom: height * 0.045),child: Text(
                        'You can be more specific for your reason to report this user.',textAlign: TextAlign.center,style: TextStyle(
                          fontSize: 16.5,TextField(),]),

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。