SliverConstrainedCrossAxis class
A sliver that constrains the cross axis extent of its sliver child.
The SliverConstrainedCrossAxis takes a maxExtent parameter and uses it as the cross axis extent of the SliverConstraints passed to the sliver child. The widget ensures that the maxExtent is a nonnegative value.
This is useful when you want to apply a custom cross-axis extent constraint to a sliver child, as slivers typically consume the full cross axis extent.
This widget also sets its parent data's SliverPhysicalParentData.crossAxisFlex to 0, so that it informs SliverCrossAxisGroup that it should not flex in the cross axis direction.
To create a local project with this code sample, run:
flutter create --sample=widgets.SliverConstrainedCrossAxis.1 mysample
See also:
- SliverCrossAxisGroup, the widget which makes use of 0 flex factor set by this widget.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SliverConstrainedCrossAxis
Constructors
- SliverConstrainedCrossAxis({Key? key, required double maxExtent, required Widget sliver})
-
Creates a sliver that constrains the cross axis extent of its sliver child.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxExtent → double
-
The cross axis extent to apply to the sliver child.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sliver → Widget
-
The widget below this widget in the tree.
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