Update: 2026-05-06 04:02:34
This commit is contained in:
60
musadaq-app/lib/core/utils/app_snackbar.dart
Normal file
60
musadaq-app/lib/core/utils/app_snackbar.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
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),
|
||||
);
|
||||
}
|
||||
}
|
||||
18
musadaq-app/lib/core/utils/logger.dart
Normal file
18
musadaq-app/lib/core/utils/logger.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'dart:developer' as developer;
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class AppLogger {
|
||||
/// Custom print function that only logs in debug mode.
|
||||
static void print(String message, {String name = 'Musadaq'}) {
|
||||
if (kDebugMode) {
|
||||
developer.log(message, name: name);
|
||||
}
|
||||
}
|
||||
|
||||
/// Custom error logger
|
||||
static void error(String message, [dynamic error, StackTrace? stackTrace]) {
|
||||
if (kDebugMode) {
|
||||
developer.log(message, name: 'Musadaq_Error', error: error, stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user