AlertComponentOptions constructor
AlertComponentOptions({
- required bool visible,
- required String message,
- String type = 'success',
- int duration = 4000,
- VoidCallback? onHide,
- Color textColor = Colors.black,
- Color? successColor,
- Color? dangerColor,
- double overlayOpacity = 0.5,
- Color overlayColor = Colors.black,
- EdgeInsetsGeometry? overlayPadding = const EdgeInsets.all(16),
- AlignmentGeometry overlayAlignment = Alignment.center,
- bool overlayDismissible = true,
- AlertTapCallback? onOverlayTap,
- bool contentDismissible = true,
- AlertTapCallback? onContentTap,
- BoxDecoration? containerDecoration,
- EdgeInsetsGeometry? containerPadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 20),
- EdgeInsetsGeometry? containerMargin,
- Clip? containerClipBehavior,
- double? maxWidth = 420,
- double? minWidth,
- TextStyle? messageStyle,
- EdgeInsetsGeometry? messagePadding,
- TextAlign messageAlignment = TextAlign.center,
- int? messageMaxLines,
- double contentSpacing = 12,
- CrossAxisAlignment contentAlignment = CrossAxisAlignment.center,
- MainAxisSize contentMainAxisSize = MainAxisSize.min,
- List<
Widget> ? actions, - Widget? leading,
- Widget? trailing,
- AlertMessageBuilder? messageBuilder,
- AlertContentBuilder? contentBuilder,
- AlertOverlayBuilder? overlayBuilder,
- Duration animationDuration = const Duration(milliseconds: 200),
- Curve animationCurve = Curves.easeInOut,
Implementation
AlertComponentOptions({
required this.visible,
required this.message,
this.type = 'success',
this.duration = 4000,
this.onHide,
this.textColor = Colors.black,
this.successColor,
this.dangerColor,
this.overlayOpacity = 0.5,
this.overlayColor = Colors.black,
this.overlayPadding = const EdgeInsets.all(16),
this.overlayAlignment = Alignment.center,
this.overlayDismissible = true,
this.onOverlayTap,
this.contentDismissible = true,
this.onContentTap,
this.containerDecoration,
this.containerPadding =
const EdgeInsets.symmetric(horizontal: 24, vertical: 20),
this.containerMargin,
this.containerClipBehavior,
this.maxWidth = 420,
this.minWidth,
this.messageStyle,
this.messagePadding,
this.messageAlignment = TextAlign.center,
this.messageMaxLines,
this.contentSpacing = 12,
this.contentAlignment = CrossAxisAlignment.center,
this.contentMainAxisSize = MainAxisSize.min,
this.actions,
this.leading,
this.trailing,
this.messageBuilder,
this.contentBuilder,
this.overlayBuilder,
this.animationDuration = const Duration(milliseconds: 200),
this.animationCurve = Curves.easeInOut,
}) : assert(duration >= 0, 'duration must be zero or positive'),
assert(overlayOpacity >= 0 && overlayOpacity <= 1,
'overlayOpacity must be between 0 and 1'),
assert(maxWidth == null || maxWidth > 0,
'maxWidth must be positive when provided'),
assert(
minWidth == null || minWidth >= 0, 'minWidth cannot be negative'),
assert(
maxWidth == null || minWidth == null || maxWidth >= minWidth,
'maxWidth must be greater than or equal to minWidth',
);