BotToast class

ToastBuilder方法生成widget时,请确保生成的Widget背景不会吸收点击事件 例如Scaffold,Material都会默认占满整个父空间, 并且会吸收事件(就算透明也是这种情况),具体例子可看material.dart->_RenderInkFeatures class->hitTestSelf method 如果真的要生成,可以考虑使用IgnorePointer. 如果没有遵守规则,将会时某些功能失效例如allowClick功能就会失效

Constructors

BotToast()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

cacheCancelFunc Map<String, List<CancelFunc>>
final

Static Methods

cleanAll() → void
closeAllLoading() → void
此方法一般使用在dispose里面,防止因为开发人员没有主动去关闭,或者是请求api时的出现异常 导致CancelFunc方法没有执行到等等,导致用户点击不了app
remove(UniqueKey key, [String groupKey]) → void
removeAll([String groupKey]) → void
showAnimationWidget({ToastBuilder toastBuilder, Duration animationDuration, Duration animationReverseDuration, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation, BackButtonBehavior backButtonBehavior, UniqueKey key, String groupKey, bool crossPage = true, bool allowClick = true, bool clickClose = false, bool ignoreContentClick = false, bool onlyOne = false, Color backgroundColor = Colors.transparent, Duration duration, VoidCallback onClose}) CancelFunc
显示一个使用了Animation的Toast 使用请看: BotToast.showCustomNotification BotToast.showCustomText BotToast.showCustomLoading BotToast.showAttachedWidget [...]
showAttachedWidget({ToastBuilder attachedBuilder, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = attachedAnimation, BuildContext targetContext, Offset target, Color backgroundColor = Colors.transparent, double verticalOffset = 0.0, double horizontalOffset = 0.0, Duration duration, Duration animationDuration, Duration animationReverseDuration, PreferDirection preferDirection, VoidCallback onClose, bool ignoreContentClick = false, bool onlyOne = false, bool allowClick = true, bool enableSafeArea}) CancelFunc
显示一个定位Toast 该方法可以在某个Widget(一般是Button)或者给定一个offset周围显示 [...]
showCustomLoading({ToastBuilder toastBuilder, WrapAnimation wrapAnimation = loadingAnimation, WrapAnimation wrapToastAnimation, Alignment align = Alignment.center, BackButtonBehavior backButtonBehavior, bool clickClose = false, bool allowClick = false, bool ignoreContentClick = false, bool crossPage = false, VoidCallback onClose, Duration duration, Duration animationDuration, Duration animationReverseDuration, Color backgroundColor = Colors.black26}) CancelFunc
显示一个自定义的加载Toast [...]
showCustomNotification({ToastBuilder toastBuilder, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = notificationAnimation, Alignment align = const Alignment(0, -0.99), List<DismissDirection> dismissDirections = const [DismissDirection.horizontal, DismissDirection.up], Duration duration = const Duration(seconds: 2), Duration animationDuration, Duration animationReverseDuration, VoidCallback onClose, BackButtonBehavior backButtonBehavior, bool enableSlideOff = true, bool crossPage = true, bool onlyOne = true}) CancelFunc
显示一个自定义的通知Toast [...]
showCustomText({ToastBuilder toastBuilder, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = textAnimation, Alignment align = const Alignment(0, 0.8), Color backgroundColor = Colors.transparent, Duration duration = const Duration(seconds: 2), Duration animationDuration, Duration animationReverseDuration, VoidCallback onClose, BackButtonBehavior backButtonBehavior, bool crossPage = true, bool clickClose = false, bool ignoreContentClick = false, bool onlyOne = false}) CancelFunc
显示一个自定义的文本Toast [...]
showEnhancedWidget({ToastBuilder toastBuilder, UniqueKey key, String groupKey, bool crossPage = true, bool allowClick = true, bool clickClose = false, bool ignoreContentClick = false, bool onlyOne = false, BackButtonBehavior backButtonBehavior, FutureFunc closeFunc, VoidCallback onClose, Color backgroundColor = Colors.transparent, WrapWidget warpWidget, Duration duration}) CancelFunc
显示一个增强Toast,该方法可以让Toast自带很多特性,例如定时关闭,点击屏幕自动关闭,离开当前Route关闭等等 核心方法,详情使用请看: BotToast.showAnimationWidget [...]
showLoading({WrapAnimation wrapAnimation = loadingAnimation, WrapAnimation wrapToastAnimation, Alignment align = Alignment.center, BackButtonBehavior backButtonBehavior, bool crossPage = true, bool clickClose = false, bool allowClick = false, VoidCallback onClose, Duration duration, Duration animationDuration, Duration animationReverseDuration, Color backgroundColor = Colors.black26}) CancelFunc
显示一个标准的加载Toast [...]
showNotification({ToastBuilder leading, ToastBuilder title, ToastBuilder subtitle, ToastBuilder trailing, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = notificationAnimation, GestureTapCallback onTap, GestureLongPressCallback onLongPress, Alignment align = const Alignment(0, -0.99), List<DismissDirection> dismissDirections = const [DismissDirection.horizontal, DismissDirection.up], BackButtonBehavior backButtonBehavior, Duration duration = const Duration(seconds: 2), Duration animationDuration, Duration animationReverseDuration, EdgeInsetsGeometry contentPadding, VoidCallback onClose, bool enableSlideOff = true, bool crossPage = true, bool onlyOne = true}) CancelFunc
显示一个标准的通知Toast [...]
showSimpleNotification({String title, String subTitle, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = notificationAnimation, GestureTapCallback onTap, GestureLongPressCallback onLongPress, Alignment align = const Alignment(0, -0.99), List<DismissDirection> dismissDirections = const [DismissDirection.horizontal, DismissDirection.up], Icon closeIcon, Duration duration = const Duration(seconds: 2), Duration animationDuration, Duration animationReverseDuration, BackButtonBehavior backButtonBehavior, VoidCallback onClose, bool enableSlideOff = true, bool hideCloseButton = false, bool crossPage = true, bool onlyOne = true}) CancelFunc
显示简单的通知Toast [...]
showText({String text, WrapAnimation wrapAnimation, WrapAnimation wrapToastAnimation = textAnimation, Color backgroundColor = Colors.transparent, Color contentColor = Colors.black54, BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(8)), TextStyle textStyle = const TextStyle(fontSize: 17, color: Colors.white), AlignmentGeometry align = const Alignment(0, 0.8), EdgeInsetsGeometry contentPadding = const EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 7), Duration duration = const Duration(seconds: 2), Duration animationDuration, Duration animationReverseDuration, BackButtonBehavior backButtonBehavior, VoidCallback onClose, bool clickClose = false, bool crossPage = true, bool onlyOne = true}) CancelFunc
显示一个标准文本Toast [...]
showWidget({ToastBuilder toastBuilder, UniqueKey key, String groupKey}) CancelFunc
显示一个Widget在屏幕上,该Widget可以跨多个页面存在 [...]

Constants

attachedKey → const String
'_attachedKey'
defaultKey → const String
'_defaultKey'
loadKey → const String
'_loadKey'
notificationKey → const String
'_notificationKey'
textKey → const String
'_textKey'