-
-
Notifications
You must be signed in to change notification settings - Fork 513
Description
I want to use specifically the SliverQuiltedGridDelegate to have as boxed a layout as possible no matter the amount of items in the grid, as it's not fixed.
Our use-case is when a user inserts irregular amount of end-items to a grid compared to the pattern, in such a case it would be nice to be able to change the pattern based on the length of the current segment.
Consider this pattern and code:
return GridView.custom(
shrinkWrap: true,
gridDelegate: SliverQuiltedGridDelegate(
crossAxisCount: 4,
repeatPattern: QuiltedGridRepeatPattern.inverted,
pattern: const [
QuiltedGridTile(2, 2),
QuiltedGridTile(1, 1),
QuiltedGridTile(1, 1),
QuiltedGridTile(1, 2),
]),
childrenDelegate: SliverChildBuilderDelegate(
childCount: widget.images.length,
(_, index) => Tile(),
),
);Which produces this result:
Now if the last image was missing, it would look like this:
Where a more fitting pattern would be something like this for the last block:
So if we could use a patternBuilder in some cases when needed, which provides the length of the images in the current segment, that would be very helpful.
I'm willing to look into how we could go about achieving this, I know it might not be super straightforward, and might be good to completely separate the new implementation from SliverQuiltedGridDelegate.


