SafeArea
在不同的平台上,有很多特殊的位置,比如 Android 系统的状态栏,或者 iPhone X 的“齐刘海”,我们应该避免在这些位置放置元素。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html
解决方案就是使用 SafeArea
部件(下面的例子分别是使用和没使用 SafeArea
的效果)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/xcx/13678.html
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