-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkc: crashStack traces logged to the consoleStack traces logged to the consoled: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on
Description
Code to Reproduce
GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(top: 15),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
mainAxisSpacing: 10,
childAspectRatio: 2.1,
),
itemCount: 0,
itemBuilder: (context, index) {
return getWidget(index);
})
The itemCount parameter is, of course, dynamic, and in the rare situation that its set to 0, and the mainAxisSpacing is also defined, it throws an exception.
The exception doesn't occur if I remove the mainAxisSpacing value, OR if I increase the itemCount to something greater than 0.
Exception:
flutter: The following assertion was thrown during performLayout():
flutter: SliverGeometry is not valid: The "scrollExtent" is negative.
flutter: The RenderSliver that returned the offending geometry was: RenderSliverGrid#fe95d relayoutBoundary=up14 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
flutter: creator: SliverGrid ← SliverPadding ← ShrinkWrappingViewport ← IgnorePointer-[GlobalKey#fd570] ←
flutter: Semantics ← _PointerListener ← Listener ← _GestureSemantics ←
flutter: RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#af9cf] ← _PointerListener ← Listener
flutter: ← _ScrollableScope ← ⋯
flutter: parentData: paintOffset=Offset(0.0, 15.0) (can use size)
flutter: constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
flutter: scrollOffset: 0.0, remainingPaintExtent: Infinity, crossAxisExtent: 384.0, crossAxisDirection:
flutter: AxisDirection.right, viewportMainAxisExtent: Infinity, remainingCacheExtent: Infinity,
flutter: cacheOrigin: 0.0)
flutter: geometry: SliverGeometry(scrollExtent: -10.0, hidden, maxPaintExtent: -10.0)
flutter: no children current live
flutter:
flutter: The relevant error-causing widget was:
flutter: GridView
Side note: The widget tree looks like this: CustomScrollView -> SliverList -> Column -> GridView.builder
Flutter (Channel master, 1.18.0-10.0.pre)
Dart version 2.9.0 (build 2.9.0-3.0.dev a69cb6d700)
jeiea, AXBYU, sgehrman, vietstone-ng, Petar81 and 1 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkc: crashStack traces logged to the consoleStack traces logged to the consoled: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on