showWcAlert function
void
showWcAlert(
- BuildContext context,
- WcBaseError error, {
- Color backgroundColor = Colors.deepPurple,
- Color textColor = Colors.white,
- int durationSeconds = 3,
Implementation
void showWcAlert(
BuildContext context,
WcBaseError error, {
Color backgroundColor = Colors.deepPurple,
Color textColor = Colors.white,
int durationSeconds = 3,
}) {
final overlay = Overlay.of(context);
final overlayEntry = OverlayEntry(
builder: (context) => Positioned(
top: 0,
left: 0,
right: 0,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 9),
child: WcAlert(
error: error,
backgroundColor: backgroundColor,
textColor: textColor,
),
),
),
);
overlay.insert(overlayEntry);
Future.delayed(Duration(seconds: durationSeconds), overlayEntry.remove);
}