其他分享
首页 > 其他分享> > flutter基础布局之 Drawer

flutter基础布局之 Drawer

作者:互联网

Drawer 一般放在标题栏上,通过ListView和ListTile的配合,用于显示隐藏的标题。

Scaffold(
  appBar: AppBar(
    title: const Text('Drawer Demo'),
  ),
  drawer: Drawer(
    child: ListView(
      padding: EdgeInsets.zero,
      children: const <Widget>[
        DrawerHeader(
          decoration: BoxDecoration(
            color: Colors.blue,
          ),
          child: Text(
            'Drawer Header',
            style: TextStyle(
              color: Colors.white,
              fontSize: 24,
            ),
          ),
        ),
        ListTile(
          leading: Icon(Icons.message),
          title: Text('Messages'),
        ),
        ListTile(
          leading: Icon(Icons.account_circle),
          title: Text('Profile'),
        ),
        ListTile(
          leading: Icon(Icons.settings),
          title: Text('Settings'),
        ),
      ],
    ),
  ),
)

 

标签:title,Text,布局,ListTile,Icons,Drawer,leading,flutter
来源: https://blog.csdn.net/computerclass/article/details/115268915