baseproject

This commit is contained in:
Gaurav Kumar
2025-09-06 19:21:52 +05:30
commit 01be9df2ed
254 changed files with 28342 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import 'package:base_project/resources/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
class ToastMessageUtil {
static void showToast({
required String message,
ToastType toastType = ToastType.info,
ToastGravity gravity = ToastGravity.TOP,
int durationInSeconds = 2,
}) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: gravity,
timeInSecForIosWeb: durationInSeconds,
backgroundColor: _getBackgroundColor(toastType),
textColor: Colors.white,
fontSize: 16.0,
);
}
static Color? _getBackgroundColor(ToastType toastType) {
switch (toastType) {
case ToastType.success:
return AppColors.success;
case ToastType.error:
return AppColors.error;
case ToastType.warning:
return AppColors.warning;
case ToastType.info:
return AppColors.info;
case ToastType.general:
return Colors.grey[900];
default:
return AppColors.info;
}
}
}
enum ToastType { success, error, warning, info, general }