ResponsiveListView class

Container Responsive container that can be used as a replacement for Container.

You can build a responsive grid layout by returning a list of ResponsiveRow in children.

Arguments of Container can be passed as is. The alignment is Alignment.center by default, which means that there will always be left and right margins when the maximum width is specified by breakpoint.

Container代わりとして利用可能なレスポンシブ対応のコンテナです。

childrenResponsiveRowのリストを返すことで、レスポンシブ対応のグリッドレイアウトを構築できます。

Containerの引数をそのまま渡すことができます。 alignmentはデフォルトでAlignment.centerになっており、breakpointによって最大の横幅が指定されているときは常に左右に余白が出るようになっています。

class GridPage extends StatelessWidget {
  const GridPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Grid"),
      ),
      body: ResponsiveBuilder(
        builder: (context) => [
          ResponsiveRow(
            children: [
              ResponsiveCol(
                lg: 12,
                child: Container(
                  color: Colors.red,
                  height: 100,
                ),
              ),
            ],
          ),
          ResponsiveRow(
            children: [
              ResponsiveCol(
                sm: 6,
                child: Container(
                  color: Colors.green,
                  height: 100,
                ),
              ),
              ResponsiveCol(
                sm: 6,
                child: Container(
                  color: Colors.blue,
                  height: 100,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
Inheritance

Constructors

ResponsiveListView({Key? key, ResponsiveBreakpoint? breakpoint, AlignmentGeometry alignment = Alignment.center, EdgeInsetsGeometry? padding, required List<ResponsiveRow> children, Clip clipBehavior = Clip.hardEdge, Axis scrollDirection = Axis.vertical, bool reverse = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, bool? primary, ScrollPhysics? physics, ScrollController? controller, String? restorationId})
Container Responsive container that can be used as a replacement for Container.
const

Properties

alignment AlignmentGeometry
This value holds the alignment to be used by the container.
final
breakpoint ResponsiveBreakpoint?
Describe breakpoints for responsive containers.
final
children List<ResponsiveRow>
Builder for specifying the inside of a container.
final
clipBehavior Clip
The clip behavior when Container.decoration is not null.
final
controller ScrollController?
The controller for the scroll position.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
The keyboard dismiss behavior for a scrollable widget.
final
padding EdgeInsetsGeometry?
Defines where to place the widget with respect to its parent.
final
physics ScrollPhysics?
How the scroll view should respond to user input.
final
primary bool?
Whether this is the primary scroll view associated with the parent PrimaryScrollController.
final
restorationId String?
Restoration ID to save and restore the scroll offset of the scrollable.
final
reverse bool
Whether the scroll view scrolls in the reading direction.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
The axis along which the scroll view scrolls.
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