Home > Blockchain >  Flutter Staggered Grid View Tile not defined
Flutter Staggered Grid View Tile not defined

Time:07-29

I am trying to implement the Quilted Grid View from this Flutter package but it appears it cannot find the Tile class. This is the code I am looking at below with the documentation link.

GridView.custom(
  gridDelegate: SliverQuiltedGridDelegate(
    crossAxisCount: 4,
    mainAxisSpacing: 4,
    crossAxisSpacing: 4,
    repeatPattern: QuiltedGridRepeatPattern.inverted,
    pattern: [
      QuiltedGridTile(2, 2),
      QuiltedGridTile(1, 1),
      QuiltedGridTile(1, 1),
      QuiltedGridTile(1, 2),
    ],
  ),
  childrenDelegate: SliverChildBuilderDelegate(
    (context, index) => Tile(index: index),
  ),
)

https://pub.dev/packages/flutter_staggered_grid_view

Here is a Flutlab (need an account to view) of what I am trying to do: https://flutlab.io/ide/3451b0b7-753c-44bb-89f8-6b9a8290f7fe

Any help would be great thanks.

CodePudding user response:

The Tile class is provided by google_maps_flutter and this is not a widget.

height and width are double and data is Uint8List?

const Tile(this.width, this.height, this.data);

You need to return a widget form SliverChildBuilderDelegate. You can use GridTile()

childrenDelegate: SliverChildBuilderDelegate(
  (context, index) => GridTile(child: child)),
),
  • Related