Dim class

Represents CSS dimensions with optional !important suffix.

Constructors

Dim(double? value, {String unit = '', bool important = false})
Creates a new dimension with optional unit and important flag.
const
Dim.deg(double value)
Dimension in Degrees.
const
Dim.dvh(double value)
Dimension relative to the dynamic viewport height.
const
Dim.dvw(double value)
Dimension relative to the dynamic viewport width.
const
Dim.em(double value)
Dimension relative to the font size of the parent element.
const
Dim.grad(double value)
Dimension in Gradians.
const
Dim.lvh(double value)
Dimension relative to the large viewport height.
const
Dim.lvw(double value)
Dimension relative to the large viewport width.
const
Dim.percent(double value)
Dimension in Percentage.
const
Dim.pt(double value)
Dimension in Points.
const
Dim.px(double value)
Dimension in Pixels.
const
Dim.rad(double value)
Dimension in Radians.
const
Dim.raw(String raw)
Raw CSS dimension (e.g. calc(100% - 48px)).
const
Dim.rem(double value)
Dimension relative to the font size of the root element.
const
Dim.svh(double value)
Dimension relative to the small viewport height.
const
Dim.svw(double value)
Dimension relative to the small viewport width.
const
Dim.variable(String variableName, {String? defaultValue})
Variable (e.g. variable name: --naki-primary-color).
const
Dim.vh(double value)
Dimension relative to the height of the viewport.
const
Dim.vmax(double value)
Dimension relative to the maximum viewport width or height.
const
Dim.vmin(double value)
Dimension relative to the smallest viewport dimension.
const
Dim.vw(double value)
Dimension relative to the width of the viewport.
const

Properties

cssText → String
Returns a CSS-formatted dimension string.
no setter
hashCode → int
The hash code for this object.
no setteroverride
important → Dim
This dimension with the !important declaration.
no setter
isImportant → bool
Whether the dimension has the !important declaration.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unit → String
CSS unit of the dimension.
final
value → double?
Numeric value of the dimension.
final

Methods

copyWith({double? value, String? unit, bool? important}) → Dim
Creates a copy of this dimension with optional changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
String representation of this dimension.
override

Operators

operator *(num factor) → Dim
Multiplies this dimension by a factor.
operator +(Dim other) → Dim
Adds another dimension with same unit to this dimension.
operator -(Dim other) → Dim
Subtracts another dimension with same unit from this dimension.
operator /(num factor) → Dim
Divides this dimension by a factor.
operator ==(Object other) → bool
The equality operator.
override

Constants

auto → const Dim
Auto.
defaultFontSize → const Dim
Default font size (14px).
fitContent → const Dim
Fit content.
inherit → const Dim
Inherit.
maxContent → const Dim
Max content.
minContent → const Dim
Min content.
normal → const Dim
Normal size.
zero → const Dim
Zero.