ScalifySliverAppBar class
A responsive SliverAppBar that adjusts its height, title style, and flexible space based on the current screen type.
Performance Design
- Single ScalifyProvider.of lookup per build
- No duplicate LayoutBuilder — relies on Sliver framework constraints
- Title font size scaled via
.fzfor consistency
Example
CustomScrollView(
slivers: [
ScalifySliverAppBar(
title: 'My Store',
mobileExpandedHeight: 200,
desktopExpandedHeight: 350,
flexibleBackground: Image.asset('assets/banner.jpg', fit: BoxFit.cover),
),
ResponsiveGrid(useSliver: true, mobile: 2, desktop: 4, ...),
],
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ScalifySliverAppBar
Constructors
-
ScalifySliverAppBar({Key? key, required String title, TextStyle? titleStyle, double mobileExpandedHeight = 200.0, double? tabletExpandedHeight, double? desktopExpandedHeight, Widget? flexibleBackground, bool pinned = true, bool floating = false, bool stretch = true, Widget? leading, List<
Widget> ? actions, Color? backgroundColor, Color? foregroundColor, double elevation = 0.0, CollapseMode collapseMode = CollapseMode.parallax}) -
Creates a ScalifySliverAppBar.
const
Properties
-
actions
→ List<
Widget> ? -
Action widgets on the right side.
final
- backgroundColor → Color?
-
Background color. If null, uses theme defaults.
final
- collapseMode → CollapseMode
-
How the flexible space background should be placed. Default: CollapseMode.parallax.
final
- desktopExpandedHeight → double?
-
Expanded height on desktop/large desktop. Falls back to tabletExpandedHeight.
final
- elevation → double
-
Elevation. Default:
0.0.final - flexibleBackground → Widget?
-
Background widget for the flexible space (e.g., an image).
final
- floating → bool
-
Whether the app bar should become visible as soon as the user scrolls
towards the app bar. Default:
false.final - foregroundColor → Color?
-
Foreground color for title/icons. If null, uses theme defaults.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
Leading widget (e.g., back button).
final
- mobileExpandedHeight → double
-
Expanded height on mobile/watch. Default:
200.0.final - pinned → bool
-
Whether the app bar should remain visible when scrolled. Default:
true.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stretch → bool
-
Whether the flexible space should stretch when over-scrolled. Default:
true.final - tabletExpandedHeight → double?
-
Expanded height on tablet. Falls back to mobileExpandedHeight.
final
- title → String
-
The title text.
final
- titleStyle → TextStyle?
-
Title style override. Font size is scaled via
.fzif not overridden.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited