Unity_UIWidgets学习笔记07_组件Scaffold

1、构造方法

public Scaffold(
            Key key = null,
            PreferredSizeWidget appBar = null,//显示在界面顶部的一个 AppBar
            Widget body = null,//当前界面所显示的主要内容 
            Widget floatingActionButton = null,//界面的主要功能按钮
            FloatingActionButtonLocation floatingActionButtonLocation = null,//floatingActionButton的位置
            FloatingActionButtonAnimator floatingActionButtonAnimator = null,//floatingActionButton的动作
            List<Widget> persistentFooterButtons = null,//固定在下方显示的按钮,比如对话框下方的确定、取消按钮。
            Widget drawer = null,//抽屉菜单控件。
            Widget endDrawer = null,
            Widget bottomNavigationBar = null,//底部小工具
            Widget bottomSheet = null,//底部一直显示小工具
            Color backgroundColor = null,//背景颜色
            bool? resizeToAvoidBottomPadding = null,//控制界面内容 body 是否重新布局来避免底部被覆盖了,比如当键盘显示的时候,重新布局避免被键盘盖住内容。默认值为 true。
            bool? resizeToAvoidBottomInset = null,
            bool primary = true,//此应用栏是否显示在屏幕顶部
            DragStartBehavior drawerDragStartBehavior = DragStartBehavior.down//确定处理拖动开始行为的方式
        ) 

2、例子

new MaterialApp(
            home:new Scaffold(
               appBar:new AppBar(
                   title:new Text("AppBar")
               ),
               body:new Center(
                   child:new  Text($"点击的次数{count}")
               ),
               bottomNavigationBar:new BottomAppBar(
                   child:new Container(height:50)
               ),
               floatingActionButton:new FloatingActionButton(
                   onPressed:()=>{
                       setState(()=>{
                           count++;
                       });
                   },
                   tooltip:"添加",
                   child:new Icon(Icons.add)
               ),
               floatingActionButtonLocation:FloatingActionButtonLocation.centerDocked
            )  
        );

猜你喜欢

转载自www.cnblogs.com/PandaHome/p/11113308.html
今日推荐