danger static method
void
danger(
- dynamic message, {
- int? duration,
- bool showIcon = true,
})
Implementation
static void danger(dynamic message, {int? duration, bool showIcon = true}) {
final snackBar = SnackBar(
content: HStack([
if (showIcon == true) Icon(Icons.info, color: Colors.red[800]),
12.widthBox,
'$message'
.text
.color(Colors.black)
.overflow(TextOverflow.ellipsis)
.maxLines(3)
.make()
.expand(),
]).p12(),
padding: EdgeInsets.all(0),
backgroundColor: Colors.red[50],
behavior: SnackBarBehavior.floating,
duration: Duration(seconds: duration ?? 2),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(color: Colors.red[800]!),
),
);
ScaffoldMessenger.of(Get.context!)
.showSnackBar(snackBar)
.closed
.then((value) => ScaffoldMessenger.of(Get.context!).clearSnackBars());
}