Flutter 布局参考手册:SafeArea

2019-06-1517:16:14APP与小程序开发Comments5,121 views字数 362阅读模式

SafeArea

在不同的平台上,有很多特殊的位置,比如 Android 系统的状态栏,或者 iPhone X 的“齐刘海”,我们应该避免在这些位置放置元素。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html

解决方案就是使用 SafeArea 部件(下面的例子分别是使用和没使用 SafeArea 的效果)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html

Flutter 布局参考手册:SafeArea
Flutter 布局参考手册:SafeArea
Widget build(BuildContext context) {
  return Material(
    color: Colors.blue,
    child: SafeArea(
      child: SizedBox.expand(
        child: Card(color: Colors.yellowAccent),
      ),
    ),
  );
}

作者:Yuqi
链接:https://juejin.im/post/5cfe0d136fb9a07efc497d7d
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html

文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/xcx/13678.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定