flutter-安全区域控件SafeArea

1,535 阅读1分钟

ios 中有一个 SafeArea 概念,其存在是为了避免容器内部控件内容超出到 顶部 statusbar 或者 底部 切换线条(底部切出应用的横线) 影响操作体验,因此引出了 SafeArea 安全区域,在flutterreact-native中都存在这种控件,使用其可以适配内容在最佳点击范围内

当然如果底部没有按钮,只有浏览内容就不要使用该控件了,使用方式如下所示

SafeArea(
  child: Container(
    color: Colors.red,
    height: 1000,
  ),
);

看一下效果图

image.png