Material 3 brand-aware snack bar helper.
Mirrors the React DS Toast (a brand-styled wrapper over sonner) as a
thin wrapper over ScaffoldMessengerState.showSnackBar:
PulseSnackBar.show(
context,
message: '保存しました',
variant: PulseSnackBarVariant.success,
);
PulseSnackBar.show(
context,
message: '保存に失敗しました',
description: '時間をおいて再試行してください',
variant: PulseSnackBarVariant.error,
actionLabel: '再試行',
onAction: () => save(),
);
Like the React toast, the surface stays neutral (colorScheme.surface
background, outline border, 12px radius, floating) and the semantics are
carried by the leading icon color — primary / PulseSemantics.success /
PulseSemantics.warning / error.
info and error read the ColorScheme, so they follow a consumer's
re-brand. success and warning do not: they are DS-owned status
colors with no ColorScheme slot, and green meaning "succeeded" should not
change because an app's brand did. They do flip between light and dark.
Reuses Material 3 SnackBar timing and queueing — no custom queue logic.
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(
BuildContext context, {required String message, String? description, PulseSnackBarVariant variant = PulseSnackBarVariant.info, String? actionLabel, VoidCallback? onAction, Duration duration = const Duration(milliseconds: 4000)}) → ScaffoldFeatureController< SnackBar, SnackBarClosedReason> -
Builds the brand-styled SnackBar and shows it via the nearest
ScaffoldMessenger. Returns the controller from
ScaffoldMessengerState.showSnackBar (await
closedto react to dismissal).