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.auto([bool important = false])
Auto.
const
Dim.deg(double? value, [bool important = false])
Degree unit
const
Dim.dvh(double? value, [bool important = false])
Dynamic viewport height unit.
const
Dim.dvw(double? value, [bool important = false])
Dynamic viewport width unit.
const
Dim.em(double? value, [bool important = false])
Element-relative size unit.
const
Dim.fitContent([bool important = false])
Fit content.
const
Dim.grad(double? value, [bool important = false])
Gradian unit
const
Dim.inherit([bool important = false])
Inherit.
const
Dim.lvh(double? value, [bool important = false])
Large viewport height unit.
const
Dim.lvw(double? value, [bool important = false])
Large viewport width unit.
const
Dim.maxContent([bool important = false])
Max content.
const
Dim.minContent([bool important = false])
Min content.
const
Dim.normal([bool important = false])
Normal size.
const
Dim.percent(double? value, [bool important = false])
Percentage unit.
const
Dim.px(double? value, [bool important = false])
Pixels unit.
const
Dim.rad(double? value, [bool important = false])
Radian unit
const
Dim.raw(String expression, [bool important = false])
Raw expression (e.g. calc(100% - 48px)).
const
Dim.rem(double? value, [bool important = false])
Root element-relative size unit.
const
Dim.svh(double? value, [bool important = false])
Small viewport height unit.
const
Dim.svw(double? value, [bool important = false])
Small viewport width unit.
const
Dim.variable(String variableName, {bool important = false, String? defaultValue})
Variable (e.g. variable name: --naki-primary-color).
const
Dim.vh(double? value, [bool important = false])
Viewport height unit.
const
Dim.vmax(double? value, [bool important = false])
Maximum viewport unit.
const
Dim.vmin(double? value, [bool important = false])
Smallest viewport unit.
const
Dim.vw(double? value, [bool important = false])
Viewport width unit.
const
Dim.zero([bool important = false])
Zero.
const

Properties

cssText → String
Returns a CSS-formatted dimension string.
no setter
hashCode → int
The hash code for this object.
no setteroverride
important → bool
Whether the unit has the !important declaration.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unit → String
The unit type.
final
value → double?
The numeric value of the unit.
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

defaultFontSize → const Dim
Default font size (14px).