ToastThemeData class

定义后代 Toast 小部件的默认属性值。

后代小部件使用 ToastTheme.of(context) 获取当前的 ToastThemeData 对象。 ToastThemeData 的实例可以使用 ToastThemeData.copyWith 进行自定义。

默认情况下,所有 ToastThemeData 属性均为“null”。 如果为 null,Toast 将使用 来自 ThemeData 的值(如果它们存在),否则它将根据整体 Theme 的 colorScheme 提供自己的默认值。 有关详细信息,请参阅各个 Toast 属性。

Inheritance
Mixed-in types
Annotations

Constructors

ToastThemeData({TextStyle? textStyle, Color? backgroundColor, Color? foregroundColor, EdgeInsetsGeometry? padding, BorderRadius? borderRadius, VisualDensity? visualDensity, TextAlign? textAlign, Color? maskColor, double? verticalGap, double? indicatorSize, double? indicatorWidth, Widget? indicator, Widget? successIcon, Widget? errorIcon, Widget? informationIcon, ToastPosition? position, Duration? animationDuration, Duration? displayDuration, bool? dismissOnTap, bool? isInteractive, ToastAnimationBuilder? animationBuilder})
创建可用于 ThemeData.extension<ToastThemeData>() 的主题。
const

Properties

animationBuilder ToastAnimationBuilder?
动画构建器。
final
animationDuration Duration?
Toast动画时间。
final
backgroundColor Color?
Toast的背景填充颜色。
final
borderRadius BorderRadius?
圆角大小。
final
dismissOnTap bool?
是否允许点击关闭。
final
displayDuration Duration?
Toast持续时间。
final
errorIcon Widget?
错误图标。
final
foregroundColor Color?
ToastTextIcon 小部件后代的颜色。
final
hashCode int
The hash code for this object.
no setteroverride
indicator Widget?
Loading状态指示器。
final
indicatorSize double?
指示器大小。
final
indicatorWidth double?
指示器宽度。
final
informationIcon Widget?
信息图标。
final
isInteractive bool?
是否允许点击关闭
final
maskColor Color?
遮罩颜色
final
padding EdgeInsetsGeometry?
Toast的边界和它的孩子之间的填充。
final
position ToastPosition?
Toast在屏幕中的位置。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
successIcon Widget?
成功图标。
final
textAlign TextAlign?
文本应该如何水平对齐。
final
textStyle TextStyle?
文本样式。
final
type Object
The extension's type.
no setterinherited
verticalGap double?
纵向间距。
final
visualDensity VisualDensity?
定义Toast布局的紧凑程度。
final

Methods

copyWith({TextStyle? textStyle, TextAlign? textAlign, Color? backgroundColor, Color? foregroundColor, Color? maskColor, EdgeInsetsGeometry? padding, BorderRadius? borderRadius, VisualDensity? visualDensity, ToastAnimation? animation, double? verticalGap, double? indicatorSize, double? indicatorWidth, Widget? indicator, Widget? successIcon, Widget? errorIcon, Widget? informationIcon, ToastPosition? position, Duration? animationDuration, Duration? displayDuration, bool? dismissOnTap, bool? isInteractive, ToastAnimationBuilder? animationBuilder}) ToastThemeData
创建此对象的副本,但将给定字段替换为新值。
override
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
lerp(covariant ThemeExtension<ToastThemeData>? other, double t) ThemeExtension<ToastThemeData>
Linearly interpolate with another ThemeExtension object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

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