createView static method
void
createView()
Implementation
static void createView(
String msg,
BuildContext context,
int? duration,
int gravity,
Color background,
TextStyle? textStyle,
double backgroundRadius,
Border? border,
bool? rootNavigator) async {
overlayState = Overlay.of(context, rootOverlay: rootNavigator ?? false);
_overlayEntry = OverlayEntry(
builder: (BuildContext context) => ToastWidget(
duration: Duration(seconds: duration ?? Alert.lengthShort),
widget: SizedBox(
width: MediaQuery.of(context).size.width,
child: Container(
alignment: Alignment.center,
width: MediaQuery.of(context).size.width,
child: Container(
decoration: BoxDecoration(
color: background,
borderRadius: BorderRadius.circular(backgroundRadius),
border: border,
),
margin: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.fromLTRB(16, 10, 16, 10),
child: Text(msg, softWrap: true, style: textStyle),
)),
),
gravity: gravity),
);
_isVisible = true;
overlayState!.insert(_overlayEntry!);
await Future.delayed(Duration(seconds: duration ?? Alert.lengthShort));
dismiss();
}