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 (将#修改为@)