CssSizeUnit enum

Every CSS unit CssSizeLength understands.

Deliberately absent, and why:

  • ch, ex, cap, ic, lh, rlh: need font metrics flutter_html does not expose on Style.
  • svw/lvw/dvw and the height equivalents: Flutter has one viewport size, so the small/large/dynamic distinction has nothing to map onto.
  • calc(), min(), max(), clamp(): a value grammar, not a unit.
  • min-content, max-content, fit-content, stretch, auto: intrinsic sizing keywords that a ConstrainedBox cannot express.
Inheritance
Available extensions

Values

cm → const CssSizeUnit

Centimetres. 1cm = 96/2.54 px.

const CssSizeUnit('cm')
em → const CssSizeUnit

Relative to the element's own computed font-size.

const CssSizeUnit('em')
inches → const CssSizeUnit

Inches. 1in = 96px. Named inches because in is a Dart keyword.

const CssSizeUnit('in')
mm → const CssSizeUnit

Millimetres. 1mm = 96/25.4 px.

const CssSizeUnit('mm')
pc → const CssSizeUnit

Picas. 1pc = 16px.

const CssSizeUnit('pc')
percent → const CssSizeUnit

Percentage of the containing block, approximated by the incoming constraints.

const CssSizeUnit('%')
pt → const CssSizeUnit

Points. 1pt = 96/72 px.

const CssSizeUnit('pt')
px → const CssSizeUnit

CSS pixels, which are Flutter's logical pixels.

const CssSizeUnit('px')
q → const CssSizeUnit

Quarter-millimetres. 1q = 96/101.6 px.

const CssSizeUnit('q')
rem → const CssSizeUnit

Relative to the rootFontSize argument of the extension.

Null there falls back to FontSize.medium, which is 14.

const CssSizeUnit('rem')
vh → const CssSizeUnit

1% of the viewport height.

const CssSizeUnit('vh')
vmax → const CssSizeUnit

1% of the larger viewport dimension.

const CssSizeUnit('vmax')
vmin → const CssSizeUnit

1% of the smaller viewport dimension.

const CssSizeUnit('vmin')
vw → const CssSizeUnit

1% of the viewport width.

const CssSizeUnit('vw')

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suffix → String
The unit as it is written in CSS.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

values → const List<CssSizeUnit>
A constant List of the values in this enum, in order of their declaration.