nbpCustomToast function
void
nbpCustomToast({})
Implementation
void nbpCustomToast({
required BuildContext context,
required String message,
Duration duration = const Duration(seconds: 2),
Color backgroundColor = Colors.black87,
Color textColor = Colors.white,
double bottomOffset = 100,
bool isShowRightIcon = true,
}) {
final overlay = Overlay.of(context);
OverlayEntry? overlayEntry;
overlayEntry = OverlayEntry(
builder: (context) => Positioned(
bottom: bottomOffset,
left: 24,
right: 24,
child: Material(
color: Colors.transparent,
child: AnimatedOpacityToast(
message,
backgroundColor,
textColor,
isShowRightIcon: isShowRightIcon,
onDismissed: () {
overlayEntry?.remove();
},
),
),
),
);
overlay.insert(overlayEntry);
}