Flutter 如何在包含安全区域的情况下设计UserAccountsDrawerHeader
当我使用UserAccountsDrawerHeader设计抽屉标题时,有一个问题,在iPhoneX及以上型号中,安全区域有空白 正如您在代码中看到的,我在抽屉小部件中使用了UserAccountsDrawerHeaderFlutter 如何在包含安全区域的情况下设计UserAccountsDrawerHeader,flutter,flutter-layout,Flutter,Flutter Layout,当我使用UserAccountsDrawerHeader设计抽屉标题时,有一个问题,在iPhoneX及以上型号中,安全区域有空白 正如您在代码中看到的,我在抽屉小部件中使用了UserAccountsDrawerHeader class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: new AppBar(
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: Text("Sidebar Demo"),
elevation: defaultTargetPlatform == TargetPlatform.android ? 5.0 : 0.0,
),
drawer: new Drawer(
child: new ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: Text("Vijay Parmar"),
accountEmail: Text("test@gmail.com"),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.red,
child: Text("V"),
),
),
ListTile(
title: new Text("Home"),
trailing: Icon(Icons.home),
),
],
),
),
body: new Container(
child: Center(
child: Text("Home"),
),
),
);
}
}
类主页扩展了无状态小部件{
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:新的appBar(
标题:文本(“侧边栏演示”),
标高:defaultTargetPlatform==TargetPlatform.android?5.0:0.0,
),
抽屉:新抽屉(
子:新列表视图(
儿童:[
新用户帐户DrawerHeader(
账户名称:文本(“Vijay Parmar”),
帐户电子邮件:文本(“test@gmail.com"),
currentAccountPicture:CircleAvatar(
背景颜色:Colors.red,
子项:文本(“V”),
),
),
列表砖(
标题:新文本(“主页”),
尾随:图标(Icons.home),
),
],
),
),
主体:新容器(
儿童:中心(
儿童:文本(“家庭”),
),
),
);
}
}
子项:新建列表视图(
填充:仅限常量边集(顶部:0.0),
儿童:[
child: new ListView(
padding: const EdgeInsets.only(top: 0.0),
children: <Widget>[