flutter_staggered_grid_view 0.1.3 flutter_staggered_grid_view: ^0.1.3 copied to clipboard
A Flutter staggered grid view
flutter_staggered_grid_view #
A Flutter staggered grid view which supports multiple columns with rows of varying sizes.
Features #
- Configurable cross-axis count or max cross-axis extent like the GridView
- Tiles can have a fixed main-axis extent, or a multiple of the cell's length.
- Configurable main-axis and cross-axis margins between tiles.
- SliverStaggeredGrid for using in a CustomScrollView.
- Staggered and Spannable grid layouts.
Getting started #
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
...
flutter_staggered_grid_view: "^0.1.3"
In your library add the following import:
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
For help getting started with Flutter, view the online documentation.
Example #
new StaggeredGridView.countBuilder(
crossAxisCount: 4,
itemCount: 8,
itemBuilder: (BuildContext context, int index) => new Container(
color: Colors.green,
child: new Center(
child: new CircleAvatar(
backgroundColor: Colors.white,
child: new Text('$index'),
),
)),
staggeredTileBuilder: (int index) =>
new StaggeredTile.count(2, index.isEven ? 2 : 1),
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,
)
You can find more examples in the Example project.
Constructors #
The StaggeredGridView
follow the same constructors convention than the GridView.
There are two more constructors: countBuilder
and extentBuilder
. These constructors allow you to define a builder for the layout and a builder for the children.
Changelog #
Please see the Changelog page to know what's recently changed.
Contributions #
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a new feature, please send a pull request.