Snackbar属性和说明
总共38个属性,
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 弹出的标题文字 | String | |
| message | 弹出的消息文字 | String | |
| colorText | title和message的文字颜色 | Color | Colors.black |
| duration | 弹出的持续时间 | Duration | Duration(seconds: 3) |
| instantInit | 当false可以把snackbar 放在initState | bool | true |
| snackPosition | 弹出时的位置 | SnackPosition | SnackPosition.TOP |
| titleText | 弹出标题的组件,设置该属性会导致title属性失效 | Widget | |
| messageText | 弹出消息的组件,设置该属性会导致message属性失效 | Widget | |
| icon | 弹出时图标,显示在title和message的左侧 | Widget | |
| shouldIconPulse | 弹出时图标是否闪烁 | bool | false |
| maxWidth | 最大的宽度 | double | |
| margin | 外边距 | EdgeInsets | EdgeInsets.zero |
| padding | 内边距 | EdgeInsets | EdgeInsets.all(16) |
| borderRadius | 边框圆角大小 | double | 15 |
| borderColor | 边框的颜色,必须设置borderWidth,否则无效果 | Color | |
| borderWidth | 边框的线条宽度 | double | |
| backgroundColor | 背景颜色 | Color | Colors.grey.withOpacity(0.2) |
| leftBarIndicatorColor | 左侧指示器的颜色 | Color | |
| boxShadows | 阴影颜色 | List | |
| backgroundGradient | 背景的线性颜色 | Gradient | |
| mainButton | 主要按钮,一般显示发送、确认按钮 | TextButton | |
| onTap | 点击事件回调 | OnTap | |
| isDismissible | 是否开启手势关闭,可配合dismissDirection使用 | bool | true |
| showProgressIndicator | 是否显示进度条指示器 | bool | false |
| dismissDirection | 关闭的方向 | SnackDismissDirection | |
| progressIndicatorController | 进度条指示器的动画控制器 | AnimationController | |
| progressIndicatorBackgroundColor | 进度条指示器的背景颜色 | Color | |
| progressIndicatorValueColor | 进度条指示器的背景颜色,Animation | Animation | |
| snackStyle | 是否会附加到屏幕边缘 | SnackStyle | SnackStyle.FLOATING |
| forwardAnimationCurve | 弹出的动画 | Curve | Curves.easeOutCirc |
| reverseAnimationCurve | 消失的动画 | Curve | Curves.easeOutCirc |
| animationDuration | 弹出和小时的动画时长,默认1秒 | Duration | Duration(seconds: 1) |
| barBlur | 背景的模糊度 | double | 7.0 |
| overlayBlur | 弹出时的毛玻璃效果值 | double | 0.0 |
| snackbarStatus | 弹出或消失时的事件回调(即将打开、已打开、即将关闭、已关闭) | SnackbarStatusCallback | 0.0 |
| overlayColor | 弹出时的毛玻璃的背景颜色 | Color | Colors.transparent |
| userInputForm | 用户输入表单 | Form |
Dialog属性和说明
总共25个属性,
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 弹出的Widget组件 | String | Alert |
| titlePadding | 标题的内边距 | EdgeInsetsGeometry | EdgeInsets.all(8) |
| titleStyle | 标题的样式 | TextStyle | |
| middleText | 中间内容区域显示的文字 | String | |
| middleTextStyle | 中间内容区域显示的文字样式 | TextStyle | |
| content | 弹出的内容,该值设置后middleText将无效 | Widget | |
| contentPadding | 内容的内边距 | EdgeInsetsGeometry | EdgeInsets.all(8) |
| onConfirm | 确认按钮回调 | VoidCallback | |
| onCancel | 取消按钮回调 | VoidCallback | |
| onCustom | 自定义按钮回调 | VoidCallback | |
| cancelTextColor | 取消按钮文字的颜色 | Color | |
| confirmTextColor | 确认按钮文字的颜色 | Color | |
| textConfirm | 确认按钮的文字 | String | |
| textCancel | 取消按钮的文字 | String | |
| textCustom | 自定义按钮的文字 | String | |
| confirm | 确认按钮的组件 | Widget | |
| cancel | 取消按钮的组件 | Widget | |
| custom | 自定义按钮的组件 | Widget | |
| backgroundColor | 弹出框的背景颜色 | Color | |
| barrierDismissible | 是否可以通过点击背景关闭弹窗 | bool | |
| buttonColor | 按钮的文字颜色,根据按钮类型来设定不同的位置 | Color | |
| radius | 弹出框的圆角大小 | double | 20 |
| actions | 增加额外的子组件 | List | |
| onWillPop | 拦截关闭之前做一些操作 | WillPopCallback | |
| navigatorKey | 用于打开对话框的key | GlobalKey |
BottomSheet属性和说明
总共15个属性,
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| bottomsheet | 弹出的Widget组件 | Widget | |
| backgroundColor | 背景颜色 | Color | |
| elevation | b阴影 | double | |
| persistent | 是否添加到路由中 | bool | |
| shape | 边框形状,一般用于圆角效果 | ShapeBorder | |
| clipBehavior | 裁剪的方式 | Clip | |
| barrierColor | 弹出层的背景颜色 | Color | |
| ignoreSafeArea | 是否忽略安全适配 | bool | |
| isScrollControlled | 是否支持全屏弹出 | bool | false |
| useRootNavigator | 是否使用根导航 | bool | |
| isDismissible | 点击背景是否可关闭 | bool | ture |
| enableDrag | 是否可以拖动关闭 | bool | true |
| settings | 路由设置 | RouteSettings | |
| enterBottomSheetDuration | 进入时的动画时间 | Duration | |
| exitBottomSheetDuration | 退出时的动画时间 | Duration |
Get.bottomSheet(
Container(
height: 500,
child: Text('hello word'),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
backgroundColor: Colors.white,
);