letsar / flutter_staggered_grid_view

A Flutter staggered grid view
MIT License
3.12k stars 508 forks source link

Children has not been initialized #304

Closed erperejildo closed 1 year ago

erperejildo commented 1 year ago

I'm getting this after adding any layout:

return StaggeredGrid.count(
      crossAxisCount: 4,
      mainAxisSpacing: 4,
      crossAxisSpacing: 4,
      children: const [
        StaggeredGridTile.count(
          crossAxisCellCount: 2,
          mainAxisCellCount: 2,
          child: Text('0'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 2,
          mainAxisCellCount: 1,
          child: Text('1'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 1,
          mainAxisCellCount: 1,
          child: Text('2'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 1,
          mainAxisCellCount: 1,
          child: Text('3'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 4,
          mainAxisCellCount: 2,
          child: Text('4'),
        ),
      ],
    );
dmsalo commented 1 year ago

Add this parameter: axisDirection: AxisDirection.down,

laptt commented 1 year ago

Add this parameter: axisDirection: AxisDirection.down,

Thank you so much. I think this package has to handle case parameter axisDirection not filled, for ex: the default value is AxisDirection.down or throw the exact exception.