10 Flutter UI 之 抽屉侧边栏

一 抽屉侧边栏

在scaffold 组件中 可以定义左右边栏

// 左边的侧边栏

        drawer: Drawer(child: Center(child: Text("左边的"))),
        // 右边的侧边栏
        endDrawer: Drawer(child: Center(child: Text("右边的"))),

二 DrawHeader

       // 左边的侧边栏
        drawer: Drawer(
            child: Column(
          children: [
            //
            DrawerHeader(
              // 装饰的属性
              decoration: BoxDecoration(
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: NetworkImage(
                          "https://img0.baidu.com/it/u=2028084904,3939052004&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"))),
              child: Text("我是抽屉头部"),
            ),

            ListTile(
              leading: Icon(Icons.home),
              title: Text("第一行"),
            ),
            Divider(
              height: 1,
            ),
            ListTile(
              leading: Icon(Icons.home),
              title: Text("第二行"),
            ),
            Divider(
              height: 1,
            ),
            ListTile(
              leading: Icon(Icons.home),
              title: Text("第三行"),
            ),
            Divider(
              height: 1,
            )
          ],
        ))

三 侧边栏的跳转和隐藏

Navigator.of(context).pop(); Navigator.pushNamed(context, '/search'); }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值