Flutter:基础组件 - Scaffold

Scaffold(脚手架):是Flutter开发中很常用到的组件。

官方的描述:Creates a visual scaffold for material design widgets.

为Material Design Widgets创建可视化的脚手架。

const Scaffold({ 
  Key key,//Controls how one widget replaces another widget in the tree.//不懂,有空研究下。  
  this.appBar,//一般传入AppBar类。例:AppBar();this.body,//主体内容<Widget>
  this.floatingActionButton,//一个浮动在body上的按钮。默认悬浮在右下角                
  this.floatingActionButtonLocation,//控制浮动按钮的位置。例如FloatingActionButtonLocation.centerDocked,浮动按钮在下方中间
  this.floatingActionButtonAnimator,//浮动按钮改变位置时的动画。默认为FloatingActionButtonAnimator.scaling
  this.persistentFooterButtons,//多状态按钮。(在底部创建一组按钮,不随body滚动。)
  this.drawer,// 左侧的抽屉菜单<Widget>,点击之后从左侧滑出。
  this.endDrawer,//右侧的抽屉菜单<Widget>,
  this.bottomNavigationBar,//底部导航栏
  this.bottomSheet,//底部工具栏
  this.backgroundColor,//背景颜色
  this.resizeToAvoidBottomPadding,//**官方建议不要使用此属性**,请改用resizeToAvoidBottomInset
  this.resizeToAvoidBottomInset,//如果为true,则body和脚手架的浮动小部件应自行调整大小,以避免屏幕键盘的高度由 MediaQuery的MediaQueryData.viewInsets bottom属性定义。
  this.primary = true,//会不会影响到应用栏
  this.drawerDragStartBehavior = DragStartBehavior.start,
  this.extendBody = false,//如果为true,并且指定了bottomNavigationBar或persistentFooterButtons,则将body扩展到脚手架的底部,而不是仅扩展到bottomNavigationBar或persistentFooterButtons的顶部。
  this.extendBodyBehindAppBar = false,//如果为true,并且指定了appBar,则body的高度将扩展为包括应用栏的高度,并且body的顶部与应用栏的顶部对齐
  this.drawerScrimColor,//设置在打开Drawer时蒙层的颜色。默认是灰蒙蒙的。
  this.drawerEdgeDragWidth,//Drawer的宽度。

}) : assert(primary != null),

    assert(extendBody != null),

    assert(extendBodyBehindAppBar != null),

    assert(drawerDragStartBehavior != null),

    super(key: key);

明晚有空继续编辑。学习一下怎么使用简书的编辑器。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容