DesignDensity class

How compact a look's controls stand, as Material's VisualDensity: each step of vertical takes heightStep from a control's height and each step of horizontal paddingStep from its padding at either side, from -4 (tightest) to 4 (roomiest).

Density tightens a control's face, never its tap target (DesignTapTargets): a compact face stands in the same target, with more room round it.

final height = DesignDensity.compact.height(44); // 36

See also:

Mixed-in types
Annotations

Constructors

DesignDensity({double horizontal = 0, double vertical = 0, double heightStep = 4, double paddingStep = 2})
Steps from the look's own, each between -4 and 4.
const

Properties

hashCode → int
The hash code for this object.
no setteroverride
heightDelta → double
What it adds to a control's height.
no setter
heightStep → double
What a step of vertical adds to a control's height.
final
horizontal → double
The horizontal step.
final
paddingDelta → double
What it adds to a control's padding at either side.
no setter
paddingStep → double
What a step of horizontal adds to a control's padding at either side.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vertical → double
The vertical step.
final

Methods

copyWith({double? horizontal, double? vertical, double? heightStep, double? paddingStep}) → DesignDensity
This with the given fields changed.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
height(double height, {double least = 16}) → double
height at this density, at least least.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
padding(EdgeInsets padding, {double least = 4}) → EdgeInsets
padding at this density, its sides at least least (or as they were, when less).
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringShort() → String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

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

Static Properties

adaptivePlatformDensity → DesignDensity
defaultDensityForPlatform for the running platform.
no setter

Static Methods

defaultDensityForPlatform(TargetPlatform platform) → DesignDensity
The density platform expects, as Material's: compact on macOS, Windows and Linux, standard on Android, iOS and Fuchsia.
lerp(DesignDensity a, DesignDensity b, double t) → DesignDensity
Between a and b.

Constants

comfortable → const DesignDensity
One step in: a step off a control's height.
compact → const DesignDensity
Two steps in: two steps off a control's height and its padding.
standard → const DesignDensity
The look's own.