show static method
void
show({})
Implementation
static void show({
required IconData icon,
double? iconSize,
double? textSize,
required String message,
Color backgroundColor = Colors.red,
Color textColor = Colors.white,
Duration duration = const Duration(seconds: NumberConst.INDEX_3),
bool isVibration = false, // New field
}) {
// Trigger vibration if isVibration is true and the device supports it
if (isVibration) {
Vibration.hasVibrator().then((hasVibrator) {
if (hasVibrator == true) {
Vibration.vibrate(duration: NumberConst.DURATION_200);
}
});
}
Get.snackbar(
StringConst.EMPTY,
StringConst.EMPTY,
messageText: const SizedBox(height: NumberConst.ZERO_00, width: NumberConst.ZERO_00),
titleText: ReadMoreHtml(
htmlData: message,
isBold: true,
fontSize: NumberConst.SMALL_FONT_SIZE,
fontColor: Colors.white,
),
icon: Icon(
icon,
color: textColor,
size: iconSize ?? NumberConst.SUB_HEADER_FONT_SIZE,
),
margin: const EdgeInsets.symmetric(vertical: NumberConst.INDEX_5_00, horizontal: NumberConst.DEFAULT_TEXT_FEILD_BORDER),
backgroundColor: backgroundColor,
duration: duration,
snackPosition: SnackPosition.BOTTOM,
);
}