onufitness_mobile/lib/utils/custom_sneakbar.dart
2026-01-13 11:36:24 +05:30

57 lines
1.4 KiB
Dart

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:flutter/material.dart';
void customSnackbar({
required String title,
required String message,
SnackPosition? snackPosition,
int? duration,
Color? color,
Color? textColor,
}) {
Get.closeAllSnackbars();
Get.snackbar(
title,
message,
isDismissible: true,
backgroundColor: color?.withValues(alpha: 0.7),
duration: Duration(seconds: duration ?? 3),
snackPosition: snackPosition ?? SnackPosition.TOP,
borderRadius: 10.sp,
margin: EdgeInsets.all(10.sp),
padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 22.w),
animationDuration: Duration(milliseconds: 1000),
colorText: textColor ?? Colors.black,
titleText: Text(
title,
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.bold,
color: textColor ?? Colors.black,
),
),
messageText: Text(
message,
style: TextStyle(fontSize: 16.sp, color: textColor ?? Colors.black),
),
// mainButton: TextButton(
// onPressed: () {
// Get.closeCurrentSnackbar();
// },
// child: Text(
// 'DISMISS',
// style: TextStyle(
// fontSize: 14.sp,
// color: Colors.black,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
);
}