我如何设计包括安全区域的UserAccountsDrawerHeader

时间:2019-11-22 12:46:14

标签: flutter flutter-layout

当我使用UserAccountsDrawerHeader设计抽屉标题时,这是一个问题,iPhone x及更高型号的安全区域中存在空白

正如在代码中看到的那样,我在抽屉小部件中使用了UserAccountsDrawerHeader

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"),
        ),
      ),
    );
  }
}

Here is Drawer how looks

1 个答案:

答案 0 :(得分:0)

child: new ListView(
  padding: const EdgeInsets.only(top: 0.0),
  children: <Widget>[