fabrik_snackbar
The Fabrik Snackbar package is a customizable, production-ready solution for showing snackbars and toasts in your Flutter app. It’s designed to be simple to use, highly configurable, and seamlessly integrated with your app’s theme.
Installation
Section titled “Installation”Add the package to your pubspec.yaml
:
dependencies: fabrik_snackbar: ^0.1.0
Then run:
flutter pub get
Import fabrik_snackbar
in your Dart files:
import 'package:fabrik_snackbar/fabrik_snackbar.dart';
You’re now ready to display your first snackbar or toast.
Show a Snackbar
Section titled “Show a Snackbar”You can choose from prebuilt snackbar variants or create a custom snackbar. The prebuilt options cover most common use cases, eliminating the need to manually configure properties like snackbar color, icon color, and more.
Success
Section titled “Success”FabrikSnackbar.success( context, title: 'Registration Successful!', message: 'You have been successfully registered.',);
FabrikSnackbar.error( context, title: 'Error Occurred', message: 'Something went wrong, please try again.',);
FabrikSnackbar.info( context, title: 'Heads Up!', message: 'New update is available.',);
Warning
Section titled “Warning”FabrikSnackbar.warning( context, title: 'Warning!', message: 'Your internet is unstable.',);
Custom
Section titled “Custom”FabrikSnackbar.custom( context, title: 'Custom Title', message: 'Custom background and style.', backgroundColor: Colors.purple, borderRadius: BorderRadius.circular(16), duration: const Duration(seconds: 2),);
Show a Toast
Section titled “Show a Toast”Use the FabrikToast.show
method to display a toast from anywhere in your app:
FabrikToast.show( context, message: 'Copied to Clipboard!',);
These come with built-in styles that you can override globally or per use.