AnimatedSnackBar class

A class to build and show snack bars.

You can use this class to create your custom snack bar using it's default constructor.

Or simply use one of factory methods and pass your custom configs to them.

Remember to call show method after creating snack bars to show them..

Constructors

AnimatedSnackBar({Duration duration = const Duration(seconds: 8), MobileSnackBarPosition mobileSnackBarPosition = MobileSnackBarPosition.top, DesktopSnackBarPosition desktopSnackBarPosition = DesktopSnackBarPosition.bottomLeft, MultipleSnackBarStrategy snackBarStrategy = const ColumnSnackBarStrategy(), MobilePositionSettings mobilePositionSettings = const MobilePositionSettings(), Duration animationDuration = const Duration(milliseconds: 400), Curve animationCurve = Curves.easeInOut, required WidgetBuilder builder})
AnimatedSnackBar.material(String messageText, {required AnimatedSnackBarType type, BorderRadius? borderRadius, DesktopSnackBarPosition desktopSnackBarPosition = DesktopSnackBarPosition.bottomLeft, MobileSnackBarPosition mobileSnackBarPosition = MobileSnackBarPosition.top, Duration duration = const Duration(seconds: 8), MultipleSnackBarStrategy snackBarStrategy = const ColumnSnackBarStrategy(), MobilePositionSettings mobilePositionSettings = const MobilePositionSettings(), Duration animationDuration = const Duration(milliseconds: 400), Curve animationCurve = Curves.easeInOut})
Creates a material style snack bar. Remember to call show method to show the snack bar.
factory
AnimatedSnackBar.rectangle(String titleText, String messageText, {required AnimatedSnackBarType type, DesktopSnackBarPosition desktopSnackBarPosition = DesktopSnackBarPosition.bottomLeft, MobileSnackBarPosition mobileSnackBarPosition = MobileSnackBarPosition.top, Duration duration = const Duration(seconds: 8), Brightness? brightness, MultipleSnackBarStrategy snackBarStrategy = const ColumnSnackBarStrategy(), MobilePositionSettings mobilePositionSettings = const MobilePositionSettings(), Duration animationDuration = const Duration(milliseconds: 400), Curve animationCurve = Curves.easeInOut})
Creates a rectangle style snack bar. Remember to call show method to show the snack bar.
factory

Properties

animationCurve Curve
Curve of the animation
final
animationDuration Duration
Duration of the animation
final
builder WidgetBuilder
Build your snack bar using this builder. This will be passed to RawAnimatedSnackBar and will be used to build your custom snack bar.
final
desktopSnackBarPosition DesktopSnackBarPosition
Determine which position you want the snack bar to be displayed at for web and desktop
final
duration Duration
Pass duration you want the snack bar to be visible for.
final
hashCode int
The hash code for this object.
no setterinherited
info ↔ _SnackBarInfo
latefinal
mobilePositionSettings MobilePositionSettings
Do not use this settings for default behavior. Settings aplies only on default AnimatedSnackBar constructor
final
mobileSnackBarPosition MobileSnackBarPosition
Determine which position you want the snack bar to be displayed at for mobile.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snackBarStrategy MultipleSnackBarStrategy
Determine how it should handle snack bars befoer it, Should it be shown on them like column? use ColumnSnackBarStrategy Should it remove them? use RemoveSnackBarStrategy Should it just stack on them? use StackSnackBarStrategy
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove([bool purge = true]) → void
show(BuildContext context) → void
This method will create an overlay for your snack bar and insert it to the overlay entries of navigator.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

removeAll() → void