Flutter 学习笔记 (十一) Drawer 侧边栏

Flutter 学习笔记 (一)安装及运行
Flutter 学习笔记 (二)Container组件、Text组件、图片组件
Flutter 学习笔记 (三)列表
Flutter 学习笔记 (四)Padding、Row、Column、Expanded组件
Flutter 学习笔记 (五)Stack & Align、Strack & Positioned 布局组件
Flutter 学习笔记 (六)Card、AspectRatio、CircleAvatar 组件
Flutter 学习笔记 (七)RaisedBotton、Wrap组件
Flutter 学习笔记 (八)StatefulWidget组件
Flutter 学习笔记( 九)BottomNavigationBar 组件 底部导航
Flutter 学习笔记 (十)AppBar 定义 Tab 切换
Flutter 学习笔记 (十一) Drawer 侧边栏
Flutter 学习笔记 (十二)floatingActionButton 类似闲鱼按钮
Flutter 学习笔记 (十三)TextField、Checkbox、Radio 组件
Flutter 学习笔记 (十四)时间组件
Flutter 学习笔记 (十五)flutter_swiper 轮播组件
Flutter 学习笔记 (十六)Dialog 组件
Flutter 学习笔记 (十七)网络数据请求
Flutter 学习笔记 (十八)路由跳转

class AppBarDemo extends StatefulWidget {
  AppBarDemo({Key key}) : super(key: key);

  @override
  _AppBarDemoState createState() => _AppBarDemoState();
}

class _AppBarDemoState extends State<AppBarDemo> with SingleTickerProviderStateMixin{
  TabController _tabController;

  void initState(){
    super.initState();
    _tabController=new TabController(length: 2, vsync: this);
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        child: ListView(
          children: <Widget>[
            DrawerHeader(
              child: Center(child: Text('WWWWW')),
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: NetworkImage('https://www.itying.com/images/flutter/3.png'),
                  fit: BoxFit.cover
                )
              ),
            ),
            ListTile(
              leading: CircleAvatar( child: Icon(Icons.home), ),
              title: Text('Home'),
            ),
            Divider(),
            ListTile(
              leading: CircleAvatar( child: Icon(Icons.settings), ),
              title: Text('settings'),
            ),
            Divider(),
            ListTile(
              leading: CircleAvatar( child: Icon(Icons.people), ),
              title: Text('people'),
            ),
            Divider(),
          ],
        ),
      ),
      appBar: AppBar(
        title: Text('TabControl'),
        bottom: TabBar(
          controller: _tabController,
          tabs: <Widget>[
            Tab(text: 'ASD',),
            Tab(text: 'QWE',),
          ], 
        ),
      ),
      body: TabBarView(
        controller: _tabController,
        children: <Widget>[
          Center(child: Text('111111111')),
          Center(child: Text('222222222')),
        ],
      ),
    );
  }
}

Flutter 学习笔记 (十一) Drawer 侧边栏_第1张图片

你可能感兴趣的:(Flutter)