StacSnackBar class

Core model for the SnackBar action.

Shows a Flutter SnackBar built from STAC JSON. Use with StacSnackBarParser to render at runtime.

Dart example:

const StacSnackBar(
  content: {"type": "text", "data": {"text": "Saved"}},
  behavior: StacSnackBarBehavior.floating,
);

JSON example:

{
  "actionType": "showSnackBar",
  "content": {"type": "text", "data": {"text": "Saved"}},
  "behavior": "floating"
}
Inheritance
Available extensions
Annotations
  • @JsonSerializable.new()

Constructors

StacSnackBar({required Map<String, dynamic> content, String? backgroundColor, double? elevation, StacEdgeInsets? margin, StacEdgeInsets? padding, double? width, StacShapeBorder? shape, StacHitTestBehavior? hitTestBehavior, StacSnackBarBehavior? behavior, StacSnackBarAction? action, double? actionOverflowThreshold, bool? showCloseIcon, String? closeIconColor, StacDuration? duration, Map<String, dynamic>? onVisible, StacDismissDirection? dismissDirection, StacClip? clipBehavior})
Creates a StacSnackBar that shows a snack bar.
const
StacSnackBar.fromJson(Map<String, dynamic> json)
Creates a StacSnackBar from JSON.
factory

Properties

action → StacSnackBarAction?
Optional action button.
final
actionOverflowThreshold → double?
Threshold for overflowing actions.
final
actionType → String
Unique action type string used for routing.
no setteroverride
backgroundColor → String?
Background color hex.
final
behavior → StacSnackBarBehavior?
Behavior: fixed or floating.
final
clipBehavior → StacClip?
Clip behavior.
final
closeIconColor → String?
Close icon color.
final
content → Map<String, dynamic>
Widget JSON rendered inside the SnackBar.
final
dismissDirection → StacDismissDirection?
Dismiss direction.
final
duration → StacDuration?
Display duration.
final
elevation → double?
Elevation of the SnackBar.
final
hashCode → int
The hash code for this object.
no setterinherited
hitTestBehavior → StacHitTestBehavior?
Hit test behavior.
final
jsonData → Map<String, dynamic>?
The raw JSON data associated with this action.
finalinherited
margin → StacEdgeInsets?
Outer margin.
final
onVisible → Map<String, dynamic>?
Callback action when SnackBar becomes visible.
final
padding → StacEdgeInsets?
Inner padding.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shape → StacShapeBorder?
Shape border for the SnackBar.
final
showCloseIcon → bool?
Whether to show the close icon.
final
width → double?
Fixed width.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(BuildContext context) → FutureOr

Available on StacAction?, provided by the StacActionParserExtension extension

toJson() → Map<String, dynamic>
Converts this action to JSON.
override
toString() → String
A string representation of this object.
inherited

Operators

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