letsar / flutter_staggered_grid_view

A Flutter staggered grid view

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error - LateInitializationError: Field '_children@25042623' has not been initialized.

aseem-heg opened this issue · comments

commented
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';

class Widget1 extends StatelessWidget {
  const Widget1({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return StaggeredGrid.count(
      crossAxisCount: 4,
      mainAxisSpacing: 4,
      crossAxisSpacing: 4,
      children: const [
        StaggeredGridTile.count(
          crossAxisCellCount: 2,
          mainAxisCellCount: 2,
          child: Text('alpha'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 2,
          mainAxisCellCount: 1,
          child: Text('alpha'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 1,
          mainAxisCellCount: 1,
          child: Text('alpha'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 1,
          mainAxisCellCount: 1,
          child: Text('alpha'),
        ),
        StaggeredGridTile.count(
          crossAxisCellCount: 4,
          mainAxisCellCount: 2,
          child: Text('alpha'),
        ),
      ],
    );
  }
}

Screenshot from 2023-03-14 14-59-55

commented

You can find a possible solution in the issue #285.

On which version of Flutter?