11/17/1
This commit is contained in:
69
lib/views/widgets/error_snakbar.dart
Normal file
69
lib/views/widgets/error_snakbar.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
|
||||
SnackbarController mySnackeBarError(String message) {
|
||||
return Get.snackbar(
|
||||
'Error'.tr,
|
||||
message,
|
||||
backgroundColor: AppColor.redColor.withOpacity(0.9),
|
||||
colorText: AppColor.secondaryColor,
|
||||
icon: const Icon(Icons.error, color: AppColor.secondaryColor),
|
||||
shouldIconPulse: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
margin: const EdgeInsets.all(10),
|
||||
borderRadius: 10,
|
||||
animationDuration: const Duration(milliseconds: 500),
|
||||
forwardAnimationCurve: Curves.easeOutBack,
|
||||
reverseAnimationCurve: Curves.easeInBack,
|
||||
titleText: Text(
|
||||
'Error'.tr,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
SnackbarController mySnackbarSuccess(String message) {
|
||||
return Get.snackbar(
|
||||
'Success'.tr,
|
||||
message,
|
||||
backgroundColor: AppColor.greenColor
|
||||
.withOpacity(0.9), // Assuming green color for success
|
||||
colorText: AppColor.secondaryColor,
|
||||
icon: const Icon(Icons.check_circle, color: AppColor.secondaryColor),
|
||||
shouldIconPulse: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
margin: const EdgeInsets.all(10),
|
||||
borderRadius: 10,
|
||||
animationDuration: const Duration(milliseconds: 500),
|
||||
forwardAnimationCurve: Curves.easeOutBack,
|
||||
reverseAnimationCurve: Curves.easeInBack,
|
||||
titleText: Text(
|
||||
'Success'.tr,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user