Workaround upstream grid scrolling bug when there are multiple sliver grids

This commit is contained in:
Ming Ming 2023-08-09 01:30:47 +08:00
parent 85a9157a9d
commit f8882de9d7

View file

@ -396,7 +396,15 @@ class _ButtonGrid extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverStaggeredGrid.extent( // needed to workaround a scrolling bug when there are more than one
// SliverStaggeredGrids in a CustomScrollView
// see: https://github.com/letsar/flutter_staggered_grid_view/issues/98 and
// https://github.com/letsar/flutter_staggered_grid_view/issues/265
return SliverToBoxAdapter(
child: StaggeredGridView.extent(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(0),
maxCrossAxisExtent: 256, maxCrossAxisExtent: 256,
staggeredTiles: List.filled(5, const StaggeredTile.fit(1)), staggeredTiles: List.filled(5, const StaggeredTile.fit(1)),
children: [ children: [
@ -443,6 +451,7 @@ class _ButtonGrid extends StatelessWidget {
}, },
), ),
], ],
),
); );
} }