Scaffold (大多用于初始主页)
- 基本介绍
Scaffold 提供了比较常见的页面属性。
Scaffold属性 | 介绍 |
---|---|
appBar | 页面上方导航条 |
body | 页面容器 |
floatingActionButton | 悬浮按钮 |
floatingActionButtonLocation | 悬浮按钮位置 |
floatingActionButtonAnimator | 悬浮按钮动画 |
persistentFooterButtons | 显示在底部导航条上方的一组按钮 |
drawer | 左侧菜单 |
endDrawer | 右侧菜单 |
bottomNavigationBar | 底部导航条 |
bottomSheet | 一个持久停留在body下方,底部控件上方的控件 |
backgroundColor | 背景色 |
resizeToAvoidBottomPadding | 已废弃,resizeToAvoidBottomInset作为替代 |
resizeToAvoidBottomInset | 默认为 true,防止一些小组件重复 |
primary | 是否在屏幕顶部显示Appbar, 默认为 true,Appbar 是否向上延伸到状态栏,如电池电量,时间那一栏 |
drawerDragStartBehavior | 控制 drawer 的一些特性 |
extendBody | body 是否延伸到底部控件 |
extendBodyBehindAppBar | 默认 false,为 true 时,body 会置顶到 appbar 后,如appbar 为半透明色,可以有毛玻璃效果 |
drawerScrimColor | 侧滑栏拉出来时,用来遮盖主页面的颜色 |
drawerEdgeDragWidth | 侧滑栏拉出来的宽度 |
drawerEnableOpenDragGesture | 左侧侧滑栏是否可以滑动 |
endDrawerEnableOpenDragGesture | 右侧侧滑栏是否可以滑动 |
标题 | |
---|---|
标题 | |
---|---|
BottomNavigationBar(底部导航栏)
属性介绍
BottomNavigationBar属性 | 介绍 |
---|---|
items | 必填项,设置各个按钮, |
onTap | 点击事件 |
currentIndex | 当前选中 item 下标 |
elevation | 控制阴影高度,默认为 8.0 |
type | BottomNavigationBarType,默认 fixed,设置为 shifting 时,建议设置选中样式,和为选中样式,提供一个特殊动画 |
fixedColor | 选中 item 填充色 |
backgroundColor | 整个 BottomNavigationBar 背景色 |
iconSize | 图标大小,默认 24.0 |
selectedItemColor | 选中 title 填充色 |
unselectedItemColor | 未选中 title 填充色 |
selectedIconTheme | 选中 item 图标主题 |
unselectedIconTheme | 未选中 item 图标主题 |
selectedFontSize | 选中 title 字体大小,默认14.0 |
unselectedFontSize | 未选中 title 字体大小,默认12.0 |
selectedLabelStyle | 选中 title 样式 TextStyle |
unselectedLabelStyle | 未选中 title 样式 TextStyle |
showSelectedLabels | 是否展示选中 title,默认为true |
showUnselectedLabels | 是否展示未选中 title,默认为true |
mouseCursor | 鼠标悬停,Web 开发可以了解 |