脚手架状态栏阻止按钮触摸

问题描述

虽然我处于全屏模式,其中状态栏隐藏,但我右上角的菜单按钮仍然没有被触摸。您可以在图片中看到我选择了接收触摸的顶部栏。

enter image description here

我的菜单按钮有一半可以触摸,一半没有。

我还在小部件选择模式

中拍摄了Flutter Inspector的照片

enter image description here

我还添加了我的自定义按钮代码。仅供参考:

class RoundIconButton extends StatelessWidget {
  RoundIconButton({
    Key key,@required this.onpressed,@required this.icon,this.fillColor = Colors.transparent,}) : super(key: key);

  final Icon icon;
  final Function onpressed;
  final Color fillColor;

  @override
  Widget build(BuildContext context) {
    return RawMaterialButton(
      child: icon,onpressed: onpressed,shape: CircleBorder(),fillColor: fillColor,constraints: BoxConstraints.tightFor(height: 50.0,width: 50.0),);
  }
}

解决方法

你必须用 SafeArea 包裹你的 Scaffold,

enter image description here

没有 SafeArea 布局看起来像:

enter image description here

使用 SafeArea 布局看起来像:

enter image description here

,

使用 在子 SafeArea 和 SafeArea 内插入所有页面的主体中的脚手架 安全区域有缺口和底栏避免

Scaffold(
  body: SafeArea(
    child: ...........
    ...........
  ),),

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...