snacky

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

snacky

You deserve a simple snack! #
A lot of the current snackbar & toast libraries are too complicated for simple use cases. Snacky is a simple library that allows you to create a snackbar with minimal setup
and an easy to use API.
Demo #
https://github.com/Impaktfull/flutter_snacky/assets/21172855/daf176b6-77b1-44d4-a065-5e625d0ee50c
Usage #
@override
Widget build(BuildContext context) {
return SnackyConfiguratorWidget(
app: MaterialApp(
...
// Optional if you want to close snackies on push/replacement
navigatorObservers: [
SnackyNavigationObserver(),
],
...
),
);
}
copied to clipboard
Show a snacky #
final snacky = Snacky(
title: 'My super simple snacky title',
type: SnackyType.info, // or SnackyType.error, SnackyType.success, SnackyType.warning, SnackyType.info
showDuration: Duration(seconds: 3), // How long the snacky should be shown
transitionDuration: Duration(milliseconds: 300), // How long the transition should take
transitionCurve: Curves.easeInOut, // The curve of the transition
location: SnackyLocation.top, // Where the snacky should be shown (SnackyLocation.top or SnackyLocation.bottom)
openUntillClosed: false, // If the snacky should be open untill closed or canceled
canBeClosed: true, // If the snacky can be closed by the user (X button)
onTap: () => print('Snacky tapped'), // What should happen when the snacky is tapped
subtitle: 'My super simple snacky subtitle', // The subtitle of the snacky
leadingWidgetBuilder: (context, snacky) => Icon(Icons.check), // A widget that should be shown before the title
trailingWidgetBuilder: (context, snacky) => Icon(Icons.close), // A widget that should be shown after the title
);
SnackyController.instance.showMessage((context) => snacky);
copied to clipboard
Cancel the active snacky #
SnackyController.instance.cancelActiveSnacky()
copied to clipboard
Cancel all snackies #
SnackyController.instance.cancelAll()
copied to clipboard
Easy to extend #
You can use your own SnackyController, SnackyBuilder and Snacky-messages. This allows you to create your own snacky messages and use your own snacky controller.
By default the SnackyController is a singleton, but you can create your own instance of the SnackyController and use it in your app. Make sure to pass it to the SnackyConfiguratorWidget so that it can be used in the app.
By default the SnackyBuilder is a SimpleSnackyBuilder, but you can create your own SnackyBuilder and use it in your app. Make sure to pass it to the SnackyConfiguratorWidget so that it can be used in the app.
Todo #

❌ Add tests
❌ Add support for "material"-like snackies

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.