StacScaffold class

A Stac widget that implements the basic material design visual layout structure.

This widget corresponds to Flutter's Scaffold and provides the basic material design visual layout structure. It provides APIs for showing drawers, snack bars, and bottom sheets.

{@tool snippet} Dart Example:

const StacScaffold(
  appBar: StacAppBar(title: StacText(data: 'My App')),
  body: StacText(data: 'Hello World'),
  floatingActionButton: StacFloatingActionButton(
    onPressed: StacNavigateAction(route: '/next'),
    child: StacIcon(icon: Icons.add),
  ),
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "scaffold",
  "appBar": {
    "type": "appBar",
    "title": {"type": "text", "data": "My App"}
  },
  "body": {"type": "text", "data": "Hello World"}
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacScaffold.new({StacWidget? appBar, String? backgroundColor, StacWidget? body, StacWidget? bottomNavigationBar, StacWidget? bottomSheet, StacWidget? drawer, StacDragStartBehavior? drawerDragStartBehavior, double? drawerEdgeDragWidth, bool? drawerEnableOpenDragGesture, String? drawerScrimColor, StacWidget? endDrawer, bool? endDrawerEnableOpenDragGesture, bool? extendBody, bool? extendBodyBehindAppBar, StacWidget? floatingActionButton, StacFloatingActionButtonLocation? floatingActionButtonLocation, StacAction? onDrawerChanged, StacAction? onEndDrawerChanged, StacAlignmentDirectional? persistentFooterAlignment, List<StacWidget>? persistentFooterButtons, bool? primary, bool? resizeToAvoidBottomInset, String? restorationId})
Creates a scaffold with optional app bar, body, and other components.
const
StacScaffold.fromJson(Map<String, dynamic> json)
Creates a StacScaffold from a JSON map.
factory

Properties

appBar StacWidget?
An app bar to display at the top of the scaffold.
final
backgroundColor String?
The background color of the scaffold.
final
body StacWidget?
The primary content of the scaffold.
final
bottomNavigationBar StacWidget?
A bottom navigation bar to display at the bottom of the scaffold.
final
bottomSheet StacWidget?
A persistent bottom sheet to show below the scaffold's body.
final
drawer StacWidget?
A panel displayed to the side of the body, often hidden on mobile.
final
drawerDragStartBehavior StacDragStartBehavior?
Determines the way that drag start behavior is handled for the drawer.
final
drawerEdgeDragWidth double?
The width of the area within which a horizontal swipe will open the drawer.
final
drawerEnableOpenDragGesture bool?
Whether the drawer can be opened with a drag gesture.
final
drawerScrimColor String?
The color to use for the scrim that obscures primary content while a drawer is open.
final
endDrawer StacWidget?
A panel displayed to the side of the body, typically on the right.
final
endDrawerEnableOpenDragGesture bool?
Whether the end drawer can be opened with a drag gesture.
final
extendBody bool?
Whether the body should extend to the bottom of the scaffold.
final
extendBodyBehindAppBar bool?
Whether the body should extend behind the app bar.
final
floatingActionButton StacWidget?
A floating action button to display.
final
floatingActionButtonLocation StacFloatingActionButtonLocation?
Where to position the floating action button.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
onDrawerChanged StacAction?
Action called when the drawer is opened or closed.
final
onEndDrawerChanged StacAction?
Action called when the end drawer is opened or closed.
final
persistentFooterAlignment StacAlignmentDirectional?
The alignment of the persistent footer buttons.
final
persistentFooterButtons List<StacWidget>?
A list of buttons to display in a row below the body.
final
primary bool?
Whether this scaffold is being displayed at the top of the screen.
final
resizeToAvoidBottomInset bool?
Whether the body should size itself to avoid the window's bottom inset.
final
restorationId String?
Restoration ID to save and restore the state of the scaffold.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
The type of the widget
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this widget to a JSON map
override
toString() String
A string representation of this object.
inherited

Operators

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