ExpressiveShapeContent class

Content-aware sizing for a surface painted with geometry's border.

Place this inside the surface, with no additional external content padding or alignment sizing: this widget's bounds must equal the painted surface's bounds. It adds padding inside a precomputed safe rectangle, wraps text at the available width, and keeps it at the shape's optical center. If the parent is too small, content scales down rather than translating for more room. No per-aspect-ratio computation is required in consumer code.

For stock Flutter buttons use ExpressiveButton, which sets the necessary zero button padding and standard visual density. For a custom button, replace its Padding/Align with this widget and use geometry.border() for its surface. clearance is extra logical-pixel space for strokes/AA, beyond table clearance. Reserve the maximum inward stroke extent (including miter joins) across states.

Children must support intrinsic measurement and dry layout (Text, Icon, Row, Column; not LayoutBuilder). Painting outside a child's layout bounds, including text shadows, is not covered. overflow explicitly handles restrictive parents; scaleDown shrinks content and its padding together, never scaling up. Morph ticks need not rebuild this widget.

Inheritance

Constructors

ExpressiveShapeContent({Key? key, required ExpressiveShapeGeometry geometry, bool stretch = false, EdgeInsetsGeometry padding = const EdgeInsets.all(8), double clearance = 1, ExpressiveContentOverflow overflow = ExpressiveContentOverflow.scaleDown, required Widget? child})
const

Properties

child → Widget?
The widget below this widget in the tree.
finalinherited
clearance → double
final
geometry → ExpressiveShapeGeometry
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
overflow → ExpressiveContentOverflow
final
padding → EdgeInsetsGeometry
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stretch → bool
final

Methods

createElement() → SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) → RenderObject
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 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.
override

Operators

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