Files
food_delivery_mobile/lib/feature/common/presentation/widgets/w_toastification.dart
2025-10-29 15:16:44 +05:00

47 lines
1.3 KiB
Dart

import 'package:toastification/toastification.dart';
import '../../../../food_delivery_client.dart';
showErrorToast(String? message) {
toastification.show(
context: navigatorKey.currentContext,
type: ToastificationType.error,
style: ToastificationStyle.fillColored,
title: Text(
message ?? navigatorKey.currentContext!.loc.unexpected_error,
maxLines: 5,
),
autoCloseDuration: TimeDelayConst.duration3,
);
}
showSuccessToast(String message) {
toastification.show(
context: navigatorKey.currentContext,
type: ToastificationType.success,
style: ToastificationStyle.fillColored,
title: Text(message, maxLines: 5),
autoCloseDuration: TimeDelayConst.duration3,
);
}
showWarningToast(String message) {
toastification.show(
context: navigatorKey.currentContext,
type: ToastificationType.warning,
style: ToastificationStyle.fillColored,
title: Text(message, maxLines: 5),
autoCloseDuration: TimeDelayConst.duration3,
);
}
showInfoToast(String message) {
toastification.show(
alignment: Alignment.bottomCenter,
context: navigatorKey.currentContext,
type: ToastificationType.info,
style: ToastificationStyle.fillColored,
title: Text(message, maxLines: 5),
autoCloseDuration: TimeDelayConst.duration3,
);
}