flutter 组件字符中文备注

43 阅读2分钟

Scaffold (大多用于初始主页)

  1. 基本介绍

Scaffold 提供了比较常见的页面属性。

Scaffold属性介绍
appBar页面上方导航条
body页面容器
floatingActionButton悬浮按钮
floatingActionButtonLocation悬浮按钮位置
floatingActionButtonAnimator悬浮按钮动画
persistentFooterButtons显示在底部导航条上方的一组按钮
drawer左侧菜单
endDrawer右侧菜单
bottomNavigationBar底部导航条
bottomSheet一个持久停留在body下方,底部控件上方的控件
backgroundColor背景色
resizeToAvoidBottomPadding已废弃,resizeToAvoidBottomInset作为替代
resizeToAvoidBottomInset默认为 true,防止一些小组件重复
primary是否在屏幕顶部显示Appbar, 默认为 true,Appbar 是否向上延伸到状态栏,如电池电量,时间那一栏
drawerDragStartBehavior控制 drawer 的一些特性
extendBodybody 是否延伸到底部控件
extendBodyBehindAppBar默认 false,为 true 时,body 会置顶到 appbar 后,如appbar 为半透明色,可以有毛玻璃效果
drawerScrimColor侧滑栏拉出来时,用来遮盖主页面的颜色
drawerEdgeDragWidth侧滑栏拉出来的宽度
drawerEnableOpenDragGesture左侧侧滑栏是否可以滑动
endDrawerEnableOpenDragGesture右侧侧滑栏是否可以滑动
标题
标题

BottomNavigationBar(底部导航栏)

属性介绍

BottomNavigationBar属性介绍
items必填项,设置各个按钮,
onTap点击事件
currentIndex当前选中 item 下标
elevation控制阴影高度,默认为 8.0
typeBottomNavigationBarType,默认 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 开发可以了解