MyToast class

MyToast 提供了一个统一的 Toast 显示组件

Inheritance
Available extensions

Constructors

MyToast({Key? key, required Widget child})
const

Properties

child Widget
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
marginZero Widget

Available on Widget, provided by the WidgetMarginX extension

no setter
paddingZero Widget

Available on Widget, provided by the WidgetPaddingX extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sliverBox Widget

Available on Widget, provided by the WidgetSliverBoxX extension

no setter

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
marginAll(double margin) Widget

Available on Widget, provided by the WidgetMarginX extension

marginOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) Widget

Available on Widget, provided by the WidgetMarginX extension

marginSymmetric({double horizontal = 0.0, double vertical = 0.0}) Widget

Available on Widget, provided by the WidgetMarginX extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paddingAll(double padding) Widget

Available on Widget, provided by the WidgetPaddingX extension

paddingOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) Widget

Available on Widget, provided by the WidgetPaddingX extension

paddingSymmetric({double horizontal = 0.0, double vertical = 0.0}) Widget

Available on Widget, provided by the WidgetPaddingX extension

setFocus({String? focusKey, VoidCallback? onPressed, bool opacity = false, Color focusedBorderColor = Colors.grey, double borderWidth = 1.5, Duration animationDuration = const Duration(milliseconds: 350), double opacityBeginScale = 0.65}) Widget

Available on Widget, provided by the XlyFocusableExtension extension

showRightMenu({required BuildContext context, required List<MyMenuElement> menuElements, MyMenuPopStyle animationStyle = MyMenuPopStyle.scale, MyMenuStyle? style}) Widget

Available on Widget, provided by the RightClickMenuExtension extension

toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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

Static Methods

hideAll([int milliseconds = 0]) Widget
隐藏所有显示的 Toast
show(String message, {bool? forever, Duration? duration, TextStyle? textStyle, Color? backgroundColor, double? radius, EdgeInsetsGeometry? textPadding, ToastPosition? position, bool stackPreviousToasts = false, Duration? animationDuration, Curve? animationCurve}) Widget
显示一条 Toast 消息
showBottom(String message, {Duration? duration, Color? backgroundColor, Color? textColor, double opacity = 0.7}) Widget
在屏幕底部显示一个黑色样式的提示消息
showError(String message, {TextStyle? textStyle, Color? backgroundColor, Duration? duration, bool stackPreviousToasts = false, ToastPosition position = ToastPosition.center}) Widget
显示一个错误提示(用于异常错误)
showInfo(String message, {TextStyle? textStyle, Color? backgroundColor, Duration? duration, bool stackPreviousToasts = false, ToastPosition position = ToastPosition.center}) Widget
显示一个信息提示(用于普通信息展示)
showLoadingThenToast({required String loadingMessage, required Future<(bool, String?)> task(void updateMessage(String)?), Color? spinnerColor, Color? backgroundColor, bool stackPreviousToasts = false, void onOk(String)?, void onWarn(String)?, void onError(String)?}) Future<bool>
显示加载动画,执行任务后显示结果提示
showOk(String message, {TextStyle? textStyle, Color? backgroundColor, Duration? duration, bool stackPreviousToasts = false, ToastPosition position = ToastPosition.center}) Widget
显示一个成功提示(用于操作完成)
showSpinner({String? message, ToastPosition position = ToastPosition.center, SpinnerMessagePosition messagePosition = SpinnerMessagePosition.bottom, double? spinnerSize, Color? spinnerColor, Color? backgroundColor, TextStyle? textStyle, double? spacing, Duration? duration}) Widget
显示一个加载动画指示器
showUpError(String message, {String title = '错误', Duration? duration}) Widget
在屏幕顶部显示一个错误消息
showUpInfo(String message, {String title = '提示', Duration? duration}) Widget
在屏幕顶部显示一个信息提示
showUpWarn(String message, {String title = '警告', Duration? duration}) Widget
在屏幕顶部显示一个警告消息
showWarn(String message, {TextStyle? textStyle, Color? backgroundColor, Duration? duration, bool stackPreviousToasts = false, ToastPosition position = ToastPosition.center}) Widget
显示一个警告提示(用于预期内的失败状态)