DefaultResponsiveLayoutDelegate class

Default implementation of ResponsiveLayoutDelegate.

Considering order of supported form factors list, fills all missing matches. Widgets are matching separately for portrait and landscape orientation. For each orientation, until the explicit match is found, the first given match is used as default.

Example:

FormFactors(
  formFactors: const <FormFactor>[
    Screens.formFactorA,
    Screens.formFactorALandscape,
    Screens.formFactorB,
    Screens.formFactorC,
    Screens.formFactorD,
    Screens.formFactorE,
  child: ResponsiveLayout(
    children: {
      Screens.formFactorB: WidgetB(),
      Screens.formFactorD: WidgetD(),
    }
  )
)

class Screens {
  static const formFactorA = FormFactor(crossAxisMinWidth: 300);
  static const formFactorALandscape = FormFactor(crossAxisMinWidth: 300, orientation: Orientation.landscape);
  static const formFactorB = FormFactor(crossAxisMinWidth: 400);
  static const formFactorC = FormFactor(crossAxisMinWidth: 500);
  static const formFactorD = FormFactor(crossAxisMinWidth: 600);
  static const formFactorE = FormFactor(crossAxisMinWidth: 700);
}

For given list of form factors and explicit children matches in ResponsiveLayout, the default delegate will produce the following matches:

{
  Screens.formFactorA: WidgetB(),
  Screens.formFactorB: WidgetB(),
  Screens.formFactorC: WidgetB(),
  Screens.formFactorD: WidgetD(),
  Screens.formFactorE: WidgetD(),
  Screens.formFactorALandscape: WidgetB(),
}
Implemented types

Constructors

DefaultResponsiveLayoutDelegate()
Creates an instance of ResponsiveLayoutDelegate.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveChildren(Map<FormFactor, Widget> explicitChildren, FormFactorsData formFactorsData) Map<FormFactor, Widget>
For given list of supported form factors contained in formFactorsData and explicitly matched widgets, returns a map of matched widgets for all supported form factors.
override
toString() String
A string representation of this object.
inherited

Operators

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