SliverResizingHeader class

A sliver that is pinned to the start of its CustomScrollView and reacts to scrolling by resizing between the intrinsic sizes of its min and max extent prototypes.

The minimum and maximum sizes of this sliver are defined by minExtentPrototype and maxExtentPrototype, a pair of widgets that are laid out once. You can use SizedBox widgets to define the size limits.

If the minExtentPrototype is null, then the default minimum extent is 0. If maxExtentPrototype is null then the default maximum extent is based on the child's intrisic size.

This sliver is preferable to the general purpose SliverPersistentHeader for its relatively narrow use case because there's no need to create a SliverPersistentHeaderDelegate or to predict the header's minimum or maximum size.

This sample shows how this sliver's two extent prototype properties can be used to create a resizing header whose minimum and maximum sizes match small and large configurations of the same header widget.
link

To create a local project with this code sample, run:
flutter create --sample=widgets.SliverResizingHeader.1 mysample

See also:

Inheritance

Constructors

SliverResizingHeader({Key? key, Widget? minExtentPrototype, Widget? maxExtentPrototype, Widget? child})
Create a pinned header sliver that reacts to scrolling by resizing between the intrinsic sizes of the min and max extent prototypes.
const

Properties

child Widget?
The widget contained by this sliver.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxExtentPrototype Widget?
Laid out once to define the maximum size of this sliver along the CustomScrollView.scrollDirection axis.
final
minExtentPrototype Widget?
Laid out once to define the minimum size of this sliver along the CustomScrollView.scrollDirection axis.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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}) 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