alert function
void
alert(
- BuildContext context, {
- double? top,
- double? left,
- double? right,
- double? height,
- double? heightSpacing = 4,
- SFAlertStatus status = SFAlertStatus.primary,
- required String title,
- Widget? titleLeading,
- Widget? closeWidget,
- TextStyle? titleTextStyle,
- required String content,
- EdgeInsets? padding,
- TextStyle? contentTextStyle,
- Color? backgroundColor,
- Color? borderColor,
- BorderRadius? borderRadius,
Implementation
void alert(
BuildContext context, {
double? top,
double? left,
double? right,
double? height,
double? heightSpacing = 4,
SFAlertStatus status = SFAlertStatus.primary,
required String title,
Widget? titleLeading,
Widget? closeWidget,
TextStyle? titleTextStyle,
required String content,
EdgeInsets? padding,
TextStyle? contentTextStyle,
Color? backgroundColor,
Color? borderColor,
BorderRadius? borderRadius,
}) {
if (top != null && (top < 0.0 || top > 1.0)) {
throw ArgumentError('top value must be between 0.0 and 1.0');
}
OverlayState overlayState = Overlay.of(context);
OverlayEntry? overlayEntry;
overlayEntry = OverlayEntry(
builder: (context) => SFAlert(
top: top,
left: left,
right: right,
height: height,
heightSpacing: heightSpacing,
status: status,
title: title,
titleLeading: titleLeading,
closeWidget: closeWidget,
titleTextStyle: titleTextStyle,
content: content,
padding: padding,
contentTextStyle: contentTextStyle,
backgroundColor: backgroundColor,
borderColor: borderColor,
borderRadius: borderRadius,
onTap: () {
overlayEntry?.remove();
},
),
);
overlayState.insert(overlayEntry);
}