SizeUnit class abstract

Abstract base class for size units used in flexbox layouts.

Size units define how the size of an element is calculated relative to its content, container, or other layout constraints. They provide a flexible way to specify dimensions that can adapt to different contexts.

Size units are computed after the viewport size has been reduced by padding, giving them access to the actual available space for content.

Common size units include:

Available extensions

Constructors

SizeUnit.new()
const
SizeUnit.fixed(double value)
Creates a fixed size with the specified value.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clamp({SizeUnit min = const _FixedSize(0), SizeUnit max = const _FixedSize(double.infinity)}) SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Constrains this size unit within the specified min and max bounds.
computeSize({required ParentLayout parent, required ChildLayout child, required LayoutHandle<Layout> layoutHandle, required LayoutAxis axis, required LayoutSize contentSize, required LayoutSize viewportSize}) double
Computes the actual size value for this unit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator *(SizeUnit other) SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Multiplies two size units.
operator +(SizeUnit other) SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Adds two size units together.
operator -(SizeUnit other) SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Subtracts one size unit from another.
operator /(SizeUnit other) SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Divides one size unit by another.
operator ==(Object other) bool
The equality operator.
inherited
operator unary-() SizeUnit

Available on SizeUnit, provided by the SizeUnitExtension extension

Negates this size unit (equivalent to 0 - this).

Static Methods

lerp(SizeUnit a, SizeUnit b, double t) SizeUnit
Linearly interpolates between two size units.

Constants

fitContent → const SizeUnit
Sizes to fit the content with constraints.
maxContent → const SizeUnit
Sizes to the maximum content size (expand to fit).
minContent → const SizeUnit
Sizes to the minimum content size (shrink-wrapped).
viewportSize → const SizeUnit
Sizes to match the viewport size.
zero → const SizeUnit
A size of zero.