CommonLayoutWidget class
Provides its child with both CommonLayout 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 CommonLayoutWidget uses a LayoutBuilder to get its device constraints, no MaterialApp (or
MediaQueryData) is required above/below this widget.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CommonLayoutWidget
- Available extensions
Constructors
- CommonLayoutWidget({required Widget child, CommonLayout resolverBuilder(BoxConstraints deviceConstraints)?, RawSpacings? spacings})
-
Creates a
CommonLayoutWidgetwith a single defaultspacingsfor all breakpointsconst - CommonLayoutWidget.withResponsiveSpacings({required Widget child, CommonLayout resolverBuilder(BoxConstraints deviceConstraints)?, RawSpacings? desktopSpacings, RawSpacings? tabletSpacings, RawSpacings? phoneSpacings, RawSpacings? tinyHardwareSpacings})
-
Creates a
CommonLayoutWidgetwith specified breakpoints spacingsconst
Properties
- child → Widget
-
final
- desktopSpacings → RawSpacings?
-
Spacings corresponding to the CommonBreakpoint.desktop
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- phoneSpacings → RawSpacings?
-
Spacings corresponding to the CommonBreakpoint.phone
final
- resolverBuilder → CommonLayout Function(BoxConstraints deviceConstraints)?
-
Provides a
BoxConstraintsto build this widget's resolverfinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tabletSpacings → RawSpacings?
-
Spacings corresponding to the CommonBreakpoint.tablet
final
- tinyHardwareSpacings → RawSpacings?
-
Spacings corresponding to the CommonBreakpoint.tinyHardware
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, int wrapWidth = 65}) → 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
-
withAllPadding(
BuildContext context, Spacing spacing) → Padding -
Available on Widget, provided by the SpacingPaddingHelpers extension
Uses the RawSpacings available in thecontextto wrap all insets of this widget in a Padding with the specificspacing -
withOnlyPadding(
BuildContext context, {Spacing? left, Spacing? top, Spacing? right, Spacing? bottom}) → Padding -
Available on Widget, provided by the SpacingPaddingHelpers extension
Uses the RawSpacings available in thecontextto wrap this widget in a Padding with the respective optional insets -
withSymmetricalPadding(
BuildContext context, {Spacing? horizontal, Spacing? vertical}) → Padding -
Available on Widget, provided by the SpacingPaddingHelpers extension
Uses the RawSpacings available in thecontextto wrap this widget with the optionalhorizontalandverticalinsets in Padding
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → CommonLayout -
The resolver (
CommonLayout) from the closest CommonLayoutWidget instance that encloses the givencontext.