LayoutConstraints class final
The range of sizes a layout item may choose from when it lays itself out.
Mirrors Flutter's BoxConstraints, but implemented using Vector2.
Constructors
- LayoutConstraints({required Vector2 min, required Vector2 max})
-
const
- LayoutConstraints.loose(Vector2 size)
-
Zero to
sizein both axes. Aliasessizerather than copying, so it must already be immutable - this is checked with an assertion. Copy a mutable size with Vector2.copy first if needed.const - LayoutConstraints.tight(Vector2 size)
-
Exactly
sizein both axes. Aliasessizerather than copying, so it must already be immutable - this is checked with an assertion. Copy a mutable size with Vector2.copy first if needed.const - LayoutConstraints.unbounded()
-
No minimum; unbounded maximum, in both axes.
const
Properties
- hasBoundedHeight → bool
-
Whether max's y component is finite.
no setter
- hasBoundedWidth → bool
-
Whether max's x component is finite.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isTight → bool
-
Whether min and max are equal in both axes.
no setter
- max → Vector2
-
The largest size satisfying these constraints. Either component may be
double.infinity, meaning unbounded in that axis.
final
- min → Vector2
-
The smallest size satisfying these constraints.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
constrain(
double x, double y) → Vector2 -
The size closest to (
x,y) that satisfies these constraints. -
deflate(
EdgeInsets padding) → LayoutConstraints -
These constraints with
paddingsubtracted from min and max, clamping both so neither drops below zero and max never ends up below the deflated min. -
descale(
Vector2 scale) → LayoutConstraints -
These constraints, carried from a parent's space into the space of an
item scaled by
scale. -
enforce(
LayoutConstraints other) → LayoutConstraints -
These constraints, pulled inside
other. -
loosen(
) → LayoutConstraints - These constraints with min cleared to zero, keeping max.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override