52 lines
1.7 KiB
Dart
52 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class WarningSnackbar {
|
|
static void show({
|
|
required String title,
|
|
required String message,
|
|
SnackPosition position = SnackPosition.TOP,
|
|
Duration duration = const Duration(seconds: 4),
|
|
Color backgroundColor = Colors.red,
|
|
Color textColor = Colors.white,
|
|
double borderRadius = 10.0,
|
|
EdgeInsets margin = const EdgeInsets.all(10.0),
|
|
SnackStyle snackStyle = SnackStyle.FLOATING,
|
|
Duration animationDuration = const Duration(milliseconds: 800),
|
|
bool isDismissible = true,
|
|
DismissDirection dismissDirection = DismissDirection.horizontal,
|
|
Curve forwardAnimationCurve = Curves.easeOutBack,
|
|
Curve reverseAnimationCurve = Curves.easeInBack,
|
|
Icon icon = const Icon(Icons.warning, color: Colors.white),
|
|
bool shouldIconPulse = true,
|
|
}) {
|
|
Get.snackbar(
|
|
title,
|
|
message,
|
|
snackPosition: position,
|
|
duration: duration,
|
|
backgroundColor: backgroundColor,
|
|
colorText: textColor,
|
|
borderRadius: borderRadius,
|
|
margin: margin,
|
|
snackStyle: snackStyle,
|
|
animationDuration: animationDuration,
|
|
isDismissible: isDismissible,
|
|
dismissDirection: dismissDirection,
|
|
forwardAnimationCurve: forwardAnimationCurve,
|
|
reverseAnimationCurve: reverseAnimationCurve,
|
|
icon: icon,
|
|
shouldIconPulse: shouldIconPulse,
|
|
titleText: Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 18.0, fontWeight: FontWeight.bold, color: Colors.white),
|
|
),
|
|
messageText: Text(
|
|
message,
|
|
style: const TextStyle(fontSize: 16.0, color: Colors.white),
|
|
),
|
|
);
|
|
}
|
|
}
|