dimension library
CSS-like lengths (px, %, vw, vh, vmin, vmax) for Flutter, with min/max/clamp expressions, tweening, serialization and the DimensionSizedBox / AnimatedDimensionSizedBox widgets.
Classes
- AnimatedDimensionSizedBox
- Animated version of DimensionSizedBox which automatically transitions the width and height over duration whenever they change.
- Dimension
- Base class of Dimension. Convert to actual px value by calling the toPX() function and provide a constraint value and the screen size.
- DimensionSizedBox
- Creates a widget that sizes its child to two possible Dimension values If this widget is placed in a infinite constraint environment and either the width or height has percent unit, the constraint is clamped to the size of the screen.
- DimensionTween
- A Tween between two dimensions, see Dimension.lerp.
- Length
- This is the one actually used by users. Contains a value and a unit
- RenderDimensionSizedBox
Enums
- LengthUnit
-
The CSS-like unit of a
Length.
Extensions
- DoubleRoundingExtension on double
- Rounding and alignment helpers on double.
- DoubleToLengthExtension on double
- extension for creating Length instance from double or int
- IntToLengthExtension on int
- extension for creating Length instance from double or int
Constants
-
lengthUnitMap
→ const Map<
String, LengthUnit> - The serialized symbol of each LengthUnit.
Functions
-
parseDimension(
dynamic input) → Dimension? - Parses the output of Dimension.toJson back into a Dimension.
-
parseLength(
String? string) → Length? - Same as Length.fromJson.
-
parseLengthUnit(
String? unit) → LengthUnit? -
Returns the LengthUnit for a symbol of lengthUnitMap, ignoring
surrounding whitespace, or null if
unitis null or unknown.