show_toast 0.2.0 copy "show_toast: ^0.2.0" to clipboard
show_toast: ^0.2.0 copied to clipboard

A minimal and customizable implementation for showing toast messages.

A minimal implementation of toast messages.

Usage #

The api of this package is very simple and easy to use:

// Show a toast with any widget content:
context.showToast(content: MyToastWidget());

// Show a toast message with an opinionated and minimal look
// fitting with material design by default.
context.showToastMessage(
    message: 'My message',
    toastType: ToastType.success
);


// or if you prefer not using context extensions:
showToast(context, MyToastWidget());
showToastMessage(
    context,
    message: 'My message',
    toastType: ToastType.success
);

showToast and showToastMessage have a lot of properties to customize the look, aligment and behaviour of toasts.

Theming #

If you want to customize the theme of all toasts in your app you can optionally wrap the widget tree with a ToastTheme.

ToastTheme(
    data: ToastThemeData(
        ...
    ),
    child: MyApp(),
)

All the properties of ToastThemeData with a short description are available here.

Closing toasts #

By default toasts close after a time specified by their duration parameter, or when the user clicks them. It is also possible to close toasts programmatically.

// clear the queue of toasts
ToastManager.clearQueue()

// close the toast that is currently on screen if there is one.
ToastManager.dismiss()
2
likes
160
points
--
downloads

Publisher

verified publisherdart.share-a-bite.nl

Weekly Downloads

A minimal and customizable implementation for showing toast messages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on show_toast