QuickSnackBarUtil class
A utility class for displaying animated, customizable snackbars in Flutter.
This class provides a simple API for showing beautiful, animated snackbars with various predefined styles and extensive customization options. The snackbars use overlay rendering for better control and smoother animations.
Features:
- Multiple predefined styles (success, failure, warning, info, custom)
- Configurable position (top or bottom)
- Smooth slide, fade, and scale animations
- Progress indicator showing remaining time
- Glass morphism visual effects
- Tap-to-dismiss functionality
- Auto-dismiss after specified duration
Example Usage:
// Simple success message
QuickSnackBarUtil.show(
context: context,
message: 'Operation completed successfully!',
type: QuickSnackBarType.success,
);
// Error message with title
QuickSnackBarUtil.show(
context: context,
title: 'Error',
message: 'Something went wrong. Please try again.',
type: QuickSnackBarType.failure,
position: SnackBarPosition.top,
);
// Custom styled snackbar
QuickSnackBarUtil.show(
context: context,
title: 'Custom Message',
message: 'This is a custom colored snackbar',
type: QuickSnackBarType.custom,
customColor: Colors.purple,
duration: Duration(seconds: 5),
showIcon: false,
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
show(
{required BuildContext context, required String message, String? title, QuickSnackBarType type = QuickSnackBarType.success, SnackBarPosition position = SnackBarPosition.bottom, Color? customColor, Duration duration = const Duration(seconds: 3), double elevation = 8.0, bool showIcon = true, bool isDismissible = true}) → void - Displays an animated snackbar with the specified configuration.