ResponsiveBuilder class

A builder widget that provides different layouts based on screen size.

Use this widget for finer-grained responsive control based on screen size categories (xs, sm, md, lg, xl).

ResponsiveBuilder(
  xs: (context, info) => SingleColumnLayout(),
  sm: (context, info) => SingleColumnLayout(),
  md: (context, info) => TwoColumnLayout(),
  lg: (context, info) => ThreeColumnLayout(),
  xl: (context, info) => FourColumnLayout(),
)
Inheritance

Constructors

ResponsiveBuilder({Key? key, Widget xs(BuildContext context, AdaptiveDeviceInfo info)?, Widget sm(BuildContext context, AdaptiveDeviceInfo info)?, Widget md(BuildContext context, AdaptiveDeviceInfo info)?, Widget lg(BuildContext context, AdaptiveDeviceInfo info)?, Widget xl(BuildContext context, AdaptiveDeviceInfo info)?, Widget builder(BuildContext context, AdaptiveDeviceInfo info)?})
Creates a ResponsiveBuilder widget.
const

Properties

builder Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Default builder used when no specific builder is provided.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lg Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Builder for large screens (900-1200px).
final
md Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Builder for medium screens (600-900px).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sm Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Builder for small screens (360-600px).
final
xl Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Builder for extra large screens (> 1200px).
final
xs Widget Function(BuildContext context, AdaptiveDeviceInfo info)?
Builder for extra small screens (< 360px).
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

Operators

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