ScrollAwareFloatingActionBar class
A layout helper that overlays a floating action bar above a scrollable body.
The widget keeps the bar visibility logic close to the layout instead of duplicating it in each screen:
- Scrolling toward larger offsets hides the bar
- Scrolling back toward the top shows the bar
- Reaching the top always shows the bar
- Tapping the body toggles the bar visibility
- Swiping horizontally to change pages reveals the bar when hidden
The floatingActionBarBuilder receives the resolved visibility state so the caller can decide whether to render a FloatingActionBar or omit the bar entirely for the current screen state.
Example:
ScrollAwareFloatingActionBar(
floatingActionBarBuilder: (context, visible) => FloatingActionBar(
visible: visible,
child: ChipTabSwitcher(
tabs: const ['114-2', '114-1', '113-2'],
),
),
child: ListView.builder(
itemCount: 20,
itemBuilder: (context, index) => ListTile(
title: Text('Row $index'),
),
),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ScrollAwareFloatingActionBar
Constructors
- ScrollAwareFloatingActionBar({Key? key, required Widget child, required Widget? floatingActionBarBuilder(BuildContext context, bool visible), EdgeInsetsGeometry margin = const EdgeInsets.all(16)})
-
Creates a layout with a scroll-aware floating action bar overlay.
const
Properties
- child → Widget
-
The scrollable content rendered behind the floating action bar.
final
- floatingActionBarBuilder → Widget? Function(BuildContext context, bool visible)
-
Builds the floating action bar using the resolved visibility state.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry
-
Margin applied when positioning the floating action bar overlay.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ScrollAwareFloatingActionBar> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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