Flutter Scaffold

参数详解

属性说明
appBar头部导航栏
body主体
floatingActionButton悬浮按钮
floatingActionButtonLocation悬浮按钮位置
floatingActionButtonAnimator悬浮按钮动画
persistentFooterButtons显示在底部的一组按钮
drawer侧拉抽屉菜单
endDrawer侧拉抽屉菜单 与上面属性相反
bottomNavigationBar显示在底部的导航栏
bottomSheet要显示的持久底部工作表
backgroundColor背景颜色
resizeToAvoidBottomPadding已废弃
resizeToAvoidBottomInset为true时:浮动小部件自动调整,以避免弹出键盘时被遮盖
primary默认true
drawerDragStartBehavior默认DragStartBehavior.start
extendBody默认false
drawerScrimColor抽屉打开时用来遮盖主要内容的涂布颜色

代码示例

Scaffold(
      appBar: AppBar(
        title: Text('我是appBar'),
      ),
      body: Align(alignment: Alignment.center,child: Text('我是body'),),
      floatingActionButton: FloatingActionButton(child: Text('点我'),
        onPressed: () {},
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      // floatingActionButtonAnimator: ,
      persistentFooterButtons: [
        IconButton(icon:Icon(Icons.add),onPressed: () {},),
        FlatButton(child: Text('哈哈'),
          onPressed: () {},),
        RaisedButton(
          child: Text('我是',style: TextStyle(color: Colors.white),),
          onPressed: () {},
        ),
        RaisedButton(
          child: Text('底部',style: TextStyle(color: Colors.white),),
          onPressed: () {},
        ),
        RaisedButton(
          child: Text('按钮',style: TextStyle(color: Colors.white),),
          onPressed: () {},
        )
      ],
      drawer: Drawer(child: Align(alignment: Alignment.center,child: Text('我是drawer'),),),
      endDrawer: Drawer(child: Align(alignment: Alignment.center,child: Text('我是endDrawer'),),),
      bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.home), 
            title: Text('首页')
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.category), 
            title: Text('分类')
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.settings), 
            title: Text('设置')
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.account_circle), 
            title: Text('我的')
          ),
        ]
      ),
      bottomSheet: Text('我是bottomSheet'),
      backgroundColor: Colors.blue[100],
      // resizeToAvoidBottomPadding: ,
      resizeToAvoidBottomInset: true,
      primary: true,
      // drawerDragStartBehavior: DragStartBehavior.start,
      // extendBody: false,
      drawerScrimColor: Colors.red[100],
    );

效果图

完整代码

查看完整代码

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

马志武

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值