61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class AppSnackbar {
|
|
static void showSuccess(String title, String message) {
|
|
Get.snackbar(
|
|
title,
|
|
message,
|
|
backgroundColor: Colors.green.shade600,
|
|
colorText: Colors.white,
|
|
icon: const Icon(Icons.check_circle, color: Colors.white),
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
margin: const EdgeInsets.all(16),
|
|
borderRadius: 12,
|
|
duration: const Duration(seconds: 3),
|
|
);
|
|
}
|
|
|
|
static void showError(String title, String message) {
|
|
Get.snackbar(
|
|
title,
|
|
message,
|
|
backgroundColor: Colors.red.shade600,
|
|
colorText: Colors.white,
|
|
icon: const Icon(Icons.error, color: Colors.white),
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
margin: const EdgeInsets.all(16),
|
|
borderRadius: 12,
|
|
duration: const Duration(seconds: 4),
|
|
);
|
|
}
|
|
|
|
static void showInfo(String title, String message) {
|
|
Get.snackbar(
|
|
title,
|
|
message,
|
|
backgroundColor: Colors.blue.shade600,
|
|
colorText: Colors.white,
|
|
icon: const Icon(Icons.info, color: Colors.white),
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
margin: const EdgeInsets.all(16),
|
|
borderRadius: 12,
|
|
duration: const Duration(seconds: 3),
|
|
);
|
|
}
|
|
|
|
static void showWarning(String title, String message) {
|
|
Get.snackbar(
|
|
title,
|
|
message,
|
|
backgroundColor: Colors.orange.shade800,
|
|
colorText: Colors.white,
|
|
icon: const Icon(Icons.warning, color: Colors.white),
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
margin: const EdgeInsets.all(16),
|
|
borderRadius: 12,
|
|
duration: const Duration(seconds: 4),
|
|
);
|
|
}
|
|
}
|