GranularLayoutWidget class

Provides its child with both GranularLayout and the breakpoint-specific RawSpacings

All RawSpacings are optional and if none is provided, it uses the default values found in SpacingsInheritedWidget.defaultSpacings. These spacings act like an auxiliar set of fields that:

  • help the related code to be less prone to hardcoded values (provides type-safety with the usage of Spacing);
  • alongside the provided utilities, makes handling spacings less verbose by handling the proxying the logic to this instance's resolver.

Because GranularLayoutWidget uses a LayoutBuilder to get its device constraints, no MaterialApp (or MediaQueryData) is required above/below this widget.

Inheritance
Available Extensions

Constructors

GranularLayoutWidget({required Widget child, GranularLayout resolverBuilder(BoxConstraints deviceConstraints)?, RawSpacings? spacings})
Creates a GranularLayoutWidget with a single default spacings for all breakpoints
const
GranularLayoutWidget.withResponsiveSpacings({required Widget child, GranularLayout resolverBuilder(BoxConstraints deviceConstraints)?, RawSpacings? xxLargeSpacings, RawSpacings? xLargeSpacings, RawSpacings? largeSpacings, RawSpacings? mediumSpacings, RawSpacings? smallSpacings, RawSpacings? xSmallSpacings})
Creates a GranularLayoutWidget with specified breakpoints spacings
const

Properties

child Widget
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
largeSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.large
final
mediumSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.medium
final
resolverBuilder → (GranularLayout Function(BoxConstraints deviceConstraints)?)
Provides a BoxConstraints to build this widget's resolver
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smallSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.small
final
xLargeSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.xLarge
final
xSmallSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.xSmall
final
xxLargeSpacings RawSpacings?
Spacings corresponding to the GranularBreakpoint.xxLarge
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
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
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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

Static Methods

of(BuildContext context) GranularLayout
The resolver (GranularLayout) from the closest GranularLayoutWidget instance that encloses the given context.