Skip to main content

SliverAppBar

The Stac SliverAppBar allows you to build a Flutter sliver app bar widget using JSON. To know more about the app bar widget in Flutter, refer to the official documentation.

Properties​

PropertyTypeDescription
leadingMap<String, dynamic>?The leading widget before the title.
titleMap<String, dynamic>?The title widget.
titleTextStyleStacTextStyle?The text style for the title.
toolbarTextStyleStacTextStyle?The text style for the toolbar.
shadowColorString?The color of the shadow below the app bar.
backgroundColorString?The background color of the app bar.
foregroundColorString?The color of the app bar's foreground elements.
surfaceTintColorString?The surface tint color of the app bar.
actionsList<Map<String, dynamic>>The list of widgets to display in a row after the title. Defaults to an empty list.
bottomMap<String, dynamic>?The bottom widget of the app bar.
titleSpacingdouble?The spacing around the title.
toolbarOpacitydoubleThe opacity of the toolbar. Defaults to 1.0.
bottomOpacitydoubleThe opacity of the bottom widget. Defaults to 1.0.
toolbarHeightdouble?The height of the toolbar.
leadingWidthdouble?The width of the leading widget.
primaryboolWhether this app bar is the primary app bar for the scaffold. Defaults to true.
centerTitlebool?Whether the title should be centered.
elevationdouble?The elevation of the app bar.
scrolledUnderElevationdouble?The elevation of the app bar when it is scrolled under.
flexibleSpaceMap<String, dynamic>?This widget is stacked behind the toolbar and the tab bar.
expandedHeightdouble?The size of the app bar when it is fully expanded.
collapsedHeightdouble?The height of the app bar when it is collapsed.
titleSpacingdouble?The spacing around title content on the horizontal axis.
floatingboolMakes the app bar visible as soon as the user scrolls towards the app bar. Defaults to false.
pinnedboolMakes the app bar visible at the start of the scroll view. Defaults to true.
snapboolControls the snap behaviour of AppBar. Defaults to false.
stretchboolWhether the app bar should stretch to fill the over-scroll area. Defaults to false.
stretchTriggerOffsetdouble?The offset of overscroll required to activate onStretchTrigger.
shapeMap<String, dynamic>?The shape of the app bar's Material as well as its shadow.
iconThemeMap<String, dynamic>?The color, opacity, and size to use for toolbar icons.
actionsIconThemeMap<String, dynamic>?The color, opacity, and size to use for the icons that appear in the app bar's actions.
actionsPaddingMap<String, dynamic>?The padding between the actions and the end of the AppBar.

Example JSON​

{
"type": "sliverAppBar",
"title": {
"type": "text",
"data": "SliverAppBar"
},
"leading": {
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "material",
"icon": "menu"
},
"onPressed": {}
},
"backgroundColor": "primary",
"actions": [
{
"type": "iconButton",
"icon": {
"type": "icon",
"iconType": "cupertino",
"icon": "heart_solid"
},
"onPressed": {}
}
]
}