ToastStyle class

Style tùy chỉnh cho toast

Constructors

ToastStyle({ToastStyleType? styleType, Color backgroundColor = Colors.black87, Color textColor = Colors.white, Color? iconColor, double iconSize = 30.0, EdgeInsets? iconPadding, EdgeInsets? iconMargin, double borderRadius = 12.0, EdgeInsets padding = const EdgeInsets.all(16.0), EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), double fontSize = 14.0, EdgeInsets? textPadding, EdgeInsets? textMargin, FontWeight fontWeight = FontWeight.normal, TextAlign? textAlign, TextStyle? textStyle, Border? border, List<BoxShadow>? boxShadow, bool showIcon = true, bool showText = true, bool? showCloseButton, CrossAxisAlignment? crossAxisAlignment, double? width, double? height, Alignment? horizontalAlignment})
const

Properties

backgroundColor Color
Màu nền của toast
final
border Border?
Border của toast
final
borderRadius double
Border radius của toast
final
boxShadow List<BoxShadow>?
Shadow của toast
final
crossAxisAlignment CrossAxisAlignment?
Căn chỉnh theo chiều dọc của các phần tử trong Row (start, center, end, stretch)
final
fontSize double
Font size của text
final
fontWeight FontWeight
Font weight của text
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Chiều cao của toast (null = auto)
final
horizontalAlignment Alignment?
Căn chỉnh ngang khi toast ở vị trí top/bottom/center (left, center, right) null = dùng mặc định của position
final
iconColor Color?
Màu icon của toast
final
iconMargin EdgeInsets?
Margin xung quanh icon
final
iconPadding EdgeInsets?
Padding xung quanh icon
final
iconSize double
Kích thước icon (mặc định 30 theo memory)
final
margin EdgeInsets
Margin bên ngoài toast
final
padding EdgeInsets
Padding bên trong toast
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCloseButton bool?
Hiển thị close button (mặc định null, sẽ tự động set theo styleType)
final
showIcon bool
Hiển thị icon (mặc định true)
final
showText bool
Hiển thị text (mặc định true)
final
styleType ToastStyleType?
Loại style (flat, fillColored, flatColored, minimal)
final
textAlign TextAlign?
Text alignment của text (left, center, right, justify)
final
textColor Color
Màu chữ của toast
final
textMargin EdgeInsets?
Margin xung quanh text
final
textPadding EdgeInsets?
Padding xung quanh text
final
textStyle TextStyle?
TextStyle tùy chỉnh cho text (nếu null sẽ dùng fontSize, fontWeight, textColor)
final
width double?
Chiều rộng của toast (null = auto)
final

Methods

copyWith({ToastStyleType? styleType, Color? backgroundColor, Color? textColor, Color? iconColor, double? iconSize, EdgeInsets? iconPadding, EdgeInsets? iconMargin, double? borderRadius, EdgeInsets? padding, EdgeInsets? margin, double? fontSize, EdgeInsets? textPadding, EdgeInsets? textMargin, FontWeight? fontWeight, TextAlign? textAlign, TextStyle? textStyle, Border? border, List<BoxShadow>? boxShadow, bool? showIcon, bool? showText, bool? showCloseButton, CrossAxisAlignment? crossAxisAlignment, double? width, double? height, Alignment? horizontalAlignment}) ToastStyle
Copy với các thay đổi
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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 Methods

fromStyleType(ToastStyleType styleType, ToastType toastType) ToastStyle
Tạo style dựa trên styleType và toastType