getSnackToast static method
dynamic
getSnackToast(
- dynamic context, {
- dynamic title = "Error",
- dynamic message = '',
- dynamic snackPosition = SnackPosition.TOP,
- dynamic backgroundColor = Colors.black,
- dynamic colorText = Colors.white,
- Widget? icon,
- Duration? duration,
- Function? onTapSnackBar,
- Function? onTapButton,
- bool withButton = false,
- dynamic buttonText = 'Ok',
- Function? onDismissed,
Implementation
static getSnackToast(
context, {
title = "Error",
message = '',
snackPosition = SnackPosition.TOP,
backgroundColor = Colors.black,
colorText = Colors.white,
Widget? icon,
Duration? duration,
Function? onTapSnackBar,
Function? onTapButton,
bool withButton = false,
buttonText = 'Ok',
Function? onDismissed,
}) {
final snackBar = SnackBar(
content: Text(message),
duration: const Duration(milliseconds: 700),
backgroundColor: backgroundColor,
action: SnackBarAction(
label: title,
onPressed: () {
// Some code to undo the change.
},
),
);
// Find the ScaffoldMessenger in the widget tree
// and use it to show a SnackBar.
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}