utopic_toast
Toast Flutter package.
You are free to correct my English!
Overview
-
In the true sense of Toast, you can call it whenever you need it, without any restrictions.
-
Showing multiple dismissible toasts at the same time with showing and hiding animation.
-
Pure flutter implementation, it is not easy to bring compatibility problems
Preview
Getting started
1. add dependencies into you project pubspec.yaml file
dependencies:
utopic_toast: ^0.1.3
2. import BotToast lib
import 'package:utopic_toast/utopic_toast.dart';
3. initialization ToastOverlay
// wrap MaterialApp builder's child with ToastOverlay and set your custom params
MaterialApp(
...
builder: (context, child) {
return ToastOverlay(child: child);
},
...
);
4. use ToastManager
var toastFuture = ToastManager().showToast(
'YOUR MESSAGE TO USER',
type: ToastType.error, // set toast type to change presetted theme color
action: ToastAction(
label: 'HAY',
onPressed: (hideToastFn) {
print('yay');
hideToastFn();
},
),
duration: Duration(seconds: 3),
);
toastFuture.dismiss(); // to hide toast