Change toast
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:toastification/toastification.dart';
|
||||
|
||||
class CustomAlertDialog extends StatelessWidget {
|
||||
const CustomAlertDialog({
|
||||
@@ -49,7 +49,17 @@ class CustomAlertDialog extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
enum AlertType { info, error, success }
|
||||
enum AlertType {
|
||||
info,
|
||||
error,
|
||||
success;
|
||||
|
||||
ToastificationType get _toastificationType => switch (this) {
|
||||
success => ToastificationType.success,
|
||||
error => ToastificationType.error,
|
||||
info => ToastificationType.info,
|
||||
};
|
||||
}
|
||||
|
||||
class CustomToast extends StatelessWidget {
|
||||
const CustomToast(
|
||||
@@ -105,11 +115,18 @@ class CustomToast extends StatelessWidget {
|
||||
}
|
||||
|
||||
void show(BuildContext context) {
|
||||
final fToast = FToast().init(context);
|
||||
fToast.showToast(
|
||||
child: this,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
toastDuration: duration,
|
||||
toastification.show(
|
||||
context: context,
|
||||
title: message,
|
||||
type: type._toastificationType,
|
||||
alignment: Alignment.bottomLeft,
|
||||
autoCloseDuration: duration,
|
||||
style: ToastificationStyle.fillColored,
|
||||
pauseOnHover: true,
|
||||
showProgressBar: false,
|
||||
dragToClose: true,
|
||||
closeOnClick: true,
|
||||
closeButtonShowType: CloseButtonShowType.onHover,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user