XyScroll is a Flutter widget package that enables easy implementation of two-dimensional scrollable grids. It allows you to create content that can be scrolled both vertically and horizontally.
- Two-dimensional (vertical and horizontal) scrollable grid layout
- Customizable vertical spacing between items
- Custom ScrollPhysics for both vertical and horizontal scrolling
- Customizable padding support
xy-scroll.webm
- Add dependency to pubspec.yaml:
dependencies:
xy_scroll: ^1.0.0
- Install the package:
flutter pub get
- Import the package:
import 'package:xy_scroll/xy_scroll.dart';
Basic example:
XyScroll(
items: [
[
Container(width: 100, height: 100, color: Colors.red),
Container(width: 100, height: 100, color: Colors.blue),
Container(width: 100, height: 100, color: Colors.green),
],
[
Container(width: 100, height: 100, color: Colors.yellow),
Container(width: 100, height: 100, color: Colors.purple),
Container(width: 100, height: 100, color: Colors.orange),
],
],
verticalSpacing: 16.0,
padding: EdgeInsets.all(16.0),
)
Applying custom scroll physics:
XyScroll(
items: itemsList,
verticalPhysics: BouncingScrollPhysics(),
horizontalPhysics: ClampingScrollPhysics(),
)
Parameter | Type | Description |
---|---|---|
items | List<List> | 2D list of widgets to display |
verticalSpacing | double | Spacing between vertical items (default: 20.0) |
verticalPhysics | ScrollPhysics? | Physics for vertical scrolling |
horizontalPhysics | ScrollPhysics? | Physics for horizontal scrolling |
padding | EdgeInsetsGeometry? | Padding around the entire scroll view |
- Please report bugs and feature requests on the [Issues page]
- Pull requests are welcome
This project is released under the MIT License.