DesignSpacing class

The step a look's spacing stands on: every padding, gap and spacing token a multiple of grid.

Most systems keep a 4 pt grid (fallback). A look that keeps a finer one (iOS's and the classic Mac's 2 pt values: 6, 10, 14, 22) declares it with a DesignSpacingScope round the app, in its theme, beside its DesignTapTargetScope, and DesignSpacingCheck holds its sources to it.

DesignSpacingScope(
  spacing: const DesignSpacing(grid: 2),
  child: app,
)

See also:

  • DesignSpacingCheck.literals, which reads a look's sources for spacing off its grid.
Mixed-in types
Annotations

Constructors

DesignSpacing({double grid = 4})
A look's spacing on a grid of so many logical pixels.
const

Properties

grid → double
The step every spacing token is a multiple of.
final
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({double? grid}) → DesignSpacing
This with the given fields changed.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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 Methods

maybeOf(BuildContext context) → DesignSpacing?
The nearest DesignSpacingScope's spacing, or null when there is none.
of(BuildContext context) → DesignSpacing
The spacing in effect at context: the nearest DesignSpacingScope's, else fallback.

Constants

fallback → const DesignSpacing
The spacing with no look's own: a 4 pt grid.