Toastification class
This is the main class of the package. You can use this class to show and manage your notifications.
use show method to show a built-in notifications example :
Toastification().show(
context: context, // optional if ToastificationWrapper is in widget tree
alignment: Alignment.topRight,
title: Text('Hello World'),
description: Text('This is a notification'),
type: ToastificationType.info,
style: ToastificationStyle.flat,
autoCloseDuration: Duration(seconds: 3),
);
use showCustom method to show a custom notification
you should create your own widget and pass it to the builder parameter
example :
Toastification().showCustom(
context: context, // optional if ToastificationWrapper is in widget tree
alignment: Alignment.topRight,
animationDuration: Duration(milliseconds: 500),
autoCloseDuration: Duration(seconds: 3),
builder: (context, item) {
return CustomToastWidget();
},
);
Constructors
- Toastification()
-
returns the singleton instance of the class
factory
Properties
Methods
-
dismiss(
ToastificationItem notification, {bool showRemoveAnimation = true}) → void -
dismisses the given
notification -
dismissAll(
{bool delayForAnimation = true}) → void - dismisses all notifications that are currently showing in the screen
-
dismissById(
String id, {bool showRemoveAnimation = true}) → void -
dismisses a notification by its
id -
findToastificationItem(
String id) → ToastificationItem? -
finds and returns a ToastificationItem by its
id -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
{BuildContext? context, OverlayState? overlayState, AlignmentGeometry? alignment, Duration? autoCloseDuration, Duration? animationDuration, ToastificationAnimationBuilder? animationBuilder, ToastificationType? type, ToastificationStyle? style, Widget? title, Widget? description, Widget? icon, Color? primaryColor, Color? backgroundColor, Color? foregroundColor, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, BorderRadiusGeometry? borderRadius, BorderSide? borderSide, List< BoxShadow> ? boxShadow, TextDirection? direction, bool? showProgressBar, ProgressIndicatorThemeData? progressBarTheme, CloseButtonShowType? closeButtonShowType, ToastCloseButton closeButton = const ToastCloseButton(), bool? closeOnClick, bool? dragToClose, bool? showIcon, DismissDirection? dismissDirection, bool? pauseOnHover, bool? applyBlurEffect, ToastificationCallbacks callbacks = const ToastificationCallbacks()}) → ToastificationItem - shows a predefined toast widget base on the parameters
-
showCustom(
{BuildContext? context, AlignmentGeometry? alignment, TextDirection? direction, required ToastificationBuilder builder, ToastificationAnimationBuilder? animationBuilder, Duration? animationDuration, Duration? autoCloseDuration, OverlayState? overlayState, DismissDirection? dismissDirection, ToastificationCallbacks callbacks = const ToastificationCallbacks()}) → ToastificationItem - shows a custom notification
-
using this method you can show a notification by using the
navigatoroverlay you should create your own widget and pass it to thebuilderparameter -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited