showGlobalSnackBar function
Implementation
void showGlobalSnackBar(BuildContext context, String message,Color color,Color textColor) {
final overlay = Overlay.of(context);
final overlayEntry = OverlayEntry(
builder: (context) => Positioned(
bottom: 50,
left: 16,
right: 16,
child: Material(
elevation: 6,
borderRadius: BorderRadius.circular(8),
color: color,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
message,
style: TextStyle(color: textColor, fontSize: 16),
textAlign: TextAlign.center,
),
),
),
),
);
overlay.insert(overlayEntry);
Future.delayed(Duration(seconds: 3), () {
overlayEntry.remove();
});
}