BoxConstraintsAxisUtil extension
Extension on BoxConstraints that provides various axis-dependant utilities.
Methods
-
axisConstraints(
Axis axis) → BoxConstraints -
Returns box constraints with the same
axis
constraints but with an unconstrained cross axis. -
constrainAxis(
Axis axis, [double extent = double.infinity]) → double -
Returns the value that both satisfies the constraints and is as close as
possible to the given extent on
axis
. -
constrainAxisDimensions(
Axis axis, double cross, double main) → Size - Returns the size that both satisfies the constraints and is as close as possible to the given cross and main size.
-
constrainCrossAxis(
Axis axis, [double extent = double.infinity]) → double -
Returns the value that both satisfies the constraints and is as close as
possible to the given extent crossing
axis
. -
copyWithAxis(
Axis axis, {double? minCross, double? maxCross, double? minMain, double? maxMain}) → BoxConstraints - Creates a copy of this box constraints but with the given fields replaced with the new values.
-
crossAxisConstraints(
Axis axis) → BoxConstraints - Returns box constraints with the same cross axis constraints but with an unconstrained main axis.
-
hasBoundedAxis(
Axis axis) → bool - Whether there is an upper bound on the maximum extent of the given axis.
-
hasBoundedCrossAxis(
Axis axis) → bool - Whether there is an upper bound on the maximum extent crossing the given axis.
-
hasInfiniteAxis(
Axis axis) → bool - Whether the constraint for the given axis is infinite.
-
hasInfiniteCrossAxis(
Axis axis) → bool - Whether the constraint crossing the given axis is infinite.
-
hasTightAxis(
Axis axis) → bool - Whether there is exactly one value that satisfies the constraints on the given axis.
-
hasTightCrossAxis(
Axis axis) → bool - Whether there is exactly one value that satisfies the constraints crossing the given axis.
-
maxAxis(
Axis axis) → double - The maximum value that satisfies the constraints on the given axis.
-
maxCrossAxis(
Axis axis) → double - The maximum value that satisfies the constraints crossing the given axis.
-
minAxis(
Axis axis) → double - The minimum value that satisfies the constraints on the given axis.
-
minCrossAxis(
Axis axis) → double - The minimum value that satisfies the constraints crossing the given axis.
-
tightenAxis(
Axis axis, {double? cross, double? main}) → BoxConstraints - Returns new box constraints with a tight main and/or cross axes.
Static Methods
-
create(
Axis axis, {double minCross = 0.0, double maxCross = double.infinity, double minMain = 0.0, double maxMain = double.infinity}) → BoxConstraints - Creates box constraints with the given constraints.
-
expand(
Axis axis, {double? cross, double? main}) → BoxConstraints - Creates box constraints that expand to fill another box constraints.
-
tightFor(
Axis axis, {double? cross, double? main}) → BoxConstraints - Creates box constraints that require the given cross or main size.
-
tightForFinite(
Axis axis, {double cross = double.infinity, double main = double.infinity}) → BoxConstraints - Creates box constraints that require the given cross or main size, except if they are infinite.