ShrinkWidth class

Shrink-to-fit: min(max(min-content, room), max-content).

This is the width a browser gives a box that was not handed one -- a float, an inline-block, an item on a line that does not stretch (CSS 2.1 10.3.5) -- and the one width Flutter has no widget for. The two it has are the ends of the same range: a stretching Column takes ALL the room, and IntrinsicWidth takes the content's width whatever the room is, and answers that same number to every intrinsic question, so a Row or a flex line above it cannot make the box give any of it back.

This one narrows when the room is tight and stops at its content's width when the room is wide, and it passes both of its child's answers up unchanged: its minimum is the child's min-content, which is what lets a line shrink it, and its maximum the child's max-content.

Inheritance

Constructors

ShrinkWidth({Key? key, double? roomFactor, double roomOffset = 0, double? capFactor, double capOffset = 0, bool spill = false, double spillAlign = -1, bool atHeight = false, double? floor, Widget? child})
const

Properties

atHeight → bool
Whether the content is asked what width it wants AT THE HEIGHT this box is held to, where the room makes one tight. A flex item stretched to a line of definite height has that height (css-flexbox-1 9.4 step 11), and a picture at min-height: 100%; max-height: 100% with a ratio is as wide as that height transfers -- a telecom's app card is 334.78 wide in a 240px line, and asked with no height it answered its natural 604. Only where the line's height is definite: a line as tall as its content hands the same tight height down, and a share of THAT is auto (CSS 2.1 10.5).
final
capFactor → double?
The most the box may come to, as a share of the width it is offered plus capOffset: a percentage max-width is a share of the whole containing block (CSS 2.1 10.4), not of the room past an inset.
final
capOffset → double
final
child → Widget?
The widget below this widget in the tree.
finalinherited
floor → double?
The least the box narrows to, where that is not its content's min-content: a flex item that is a scroll container, or that clips and states min-width, gives way down to that floor in its own line (css-flexbox-1 4.5), while what it CONTRIBUTES to whatever measures it is still its content's (9.9.1) -- so the box still answers its child's intrinsic widths, and only its fit reads this. Null: the child's min-content, as ever. A scroller of four 120px cards beside a label gives way to its row of 360, and a table measuring such an item hears its content.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
roomFactor → double?
The room the box shrinks into where that is not all of the width it is offered: this share of it, plus roomOffset. An absolutely positioned box at left: 50% has only the half of its containing block past that edge (CSS 2.1 10.3.7), and it still keeps its longest word where even that is too little.
final
roomOffset → double
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spill → bool
Whether a min-content wider than the room hangs out of it. The fit is min(max(min-content, room), max-content) (css-sizing-3 5.1), so a box whose narrowest is past the room is that narrowest -- a framework site's fit-content link round an 800px image in a 358px column is 802 wide. This box still reports the room; the child it lays out at the wider width is the box the page draws.
final
spillAlign → double
Which way the child hangs out where it is wider than the box: its start on the box's start (-1, a word too long for its line), the overflow split over both edges (0), or its end on the box's end (1). An item a column does not stretch is as wide as its fit-content, and fit-content has a min-content floor (css-flexbox-1 9.4 step 7): a link round a 46px icon is 46 wide in a 40px align-items: center column and sits 3px past both edges. Start and end are the inline axis's under the Directionality the box is built in.
final

Methods

createElement() → SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) → RenderShrinkWidth
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
This method is called when a RenderObject that was previously associated with this widget is removed from the render tree. The provided RenderObject will be of the same type as the one created by this widget's createRenderObject method.
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 RenderShrinkWidth 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.
override

Operators

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