SliverCrossAxisGroup class

A sliver that places multiple sliver children in a linear array along the cross axis.

Layout algorithm

This section describes how the framework causes RenderSliverCrossAxisGroup to position its children.

Layout for a RenderSliverCrossAxisGroup has four steps:

  1. Layout each child with a null or zero flex factor with cross axis constraint being whatever cross axis space is remaining after laying out any previous sliver. Slivers with null or zero flex factor should determine their own SliverGeometry.crossAxisExtent. For example, the SliverConstrainedCrossAxis widget uses either SliverConstrainedCrossAxis.maxExtent or SliverConstraints.crossAxisExtent, deciding between whichever is smaller.
  2. Divide up the remaining cross axis space among the children with non-zero flex factors according to their flex factor. For example, a child with a flex factor of 2.0 will receive twice the amount of cross axis space as a child with a flex factor 1.0.
  3. Layout each of the remaining children with the cross axis constraint allocated in the previous step.
  4. Set the geometry to that of whichever child has the longest SliverGeometry.scrollExtent with the SliverGeometry.crossAxisExtent adjusted to SliverConstraints.crossAxisExtent.

In this sample the SliverCrossAxisGroup sizes its three children so that the first normal SliverList has a flex factor of 1, the second SliverConstrainedCrossAxis has a flex factor of 0 and a maximum cross axis extent of 200.0, and the third SliverCrossAxisExpanded has a flex factor of 2.
link

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

See also:

Inheritance

Constructors

SliverCrossAxisGroup({Key? key, required List<Widget> slivers})
Creates a sliver that places sliver children in a linear array along the cross axis.
const

Properties

children List<Widget>
The widgets below this widget in the tree.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() MultiChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) RenderSliverCrossAxisGroup
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
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
didUnmountRenderObject(covariant RenderObject renderObject) → void
A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object's createRenderObject.
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
updateRenderObject(BuildContext context, covariant RenderObject renderObject) → void
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
inherited

Operators

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