The entry point for the rich floating snackbar API.
Use the static helpers to display snackbars:
FloatingSnackBar.success(context, 'Saved!');
FloatingSnackBar.error(context, 'Something went wrong');
FloatingSnackBar.show(context, message: 'Custom', title: 'Heads up');
Global defaults
Set theme once to style every snackbar without repeating arguments.
Context-free usage
Assign navigatorKey to your MaterialApp.navigatorKey and you can then
pass null for context to show snackbars from anywhere (services, blocs,
etc.):
MaterialApp(navigatorKey: FloatingSnackBar.navigatorKey, ...);
FloatingSnackBar.info(null, 'No context needed!');
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 Properties
-
Optional global navigator key enabling context-free calls. Assign it to
MaterialApp.navigatorKey(orWidgetsApp.navigatorKey).getter/setter pair - theme ↔ FloatingSnackBarTheme
-
The app-wide default styling/behavior. Mutate this once at startup.
getter/setter pair
Static Methods
-
dismiss(
[BuildContext? context]) → void -
Dismisses the current snackbar (and clears the queue) for the overlay
resolved from
contextor the global navigatorKey. -
error(
BuildContext? context, String message, {String? title, FloatingSnackBarPosition? position, FloatingSnackBarAnimation? animation, Duration? duration, Widget? leading, FloatingSnackBarAction? action, bool? dismissOnTap, bool? showProgress, bool replace = true}) → bool - Shows an error-styled snackbar. See show for parameter details.
-
info(
BuildContext? context, String message, {String? title, FloatingSnackBarPosition? position, FloatingSnackBarAnimation? animation, Duration? duration, Widget? leading, FloatingSnackBarAction? action, bool? dismissOnTap, bool? showProgress, bool replace = true}) → bool - Shows an info-styled snackbar. See show for parameter details.
-
show(
BuildContext? context, String message, {String? title, FloatingSnackBarType type = FloatingSnackBarType.normal, FloatingSnackBarPosition? position, FloatingSnackBarAnimation? animation, Duration? duration, Widget? leading, FloatingSnackBarAction? action, Color? backgroundColor, Color? textColor, TextStyle? textStyle, TextStyle? titleStyle, bool? dismissOnTap, bool? showProgress, bool replace = true}) → bool - Displays a fully customizable floating snackbar.
-
success(
BuildContext? context, String message, {String? title, FloatingSnackBarPosition? position, FloatingSnackBarAnimation? animation, Duration? duration, Widget? leading, FloatingSnackBarAction? action, bool? dismissOnTap, bool? showProgress, bool replace = true}) → bool - Shows a success-styled snackbar. See show for parameter details.
-
warning(
BuildContext? context, String message, {String? title, FloatingSnackBarPosition? position, FloatingSnackBarAnimation? animation, Duration? duration, Widget? leading, FloatingSnackBarAction? action, bool? dismissOnTap, bool? showProgress, bool replace = true}) → bool - Shows a warning-styled snackbar. See show for parameter details.