Unverified Commit c785efad authored by Chinmoy's avatar Chinmoy Committed by GitHub

Fixed improper assertion of maxCrossAxisExtent (#75095)

parent ba5cc2cb
......@@ -447,7 +447,7 @@ class SliverGridDelegateWithMaxCrossAxisExtent extends SliverGridDelegate {
this.crossAxisSpacing = 0.0,
this.childAspectRatio = 1.0,
this.mainAxisExtent,
}) : assert(maxCrossAxisExtent != null && maxCrossAxisExtent >= 0),
}) : assert(maxCrossAxisExtent != null && maxCrossAxisExtent > 0),
assert(mainAxisSpacing != null && mainAxisSpacing >= 0),
assert(crossAxisSpacing != null && crossAxisSpacing >= 0),
assert(childAspectRatio != null && childAspectRatio > 0);
......
......@@ -783,4 +783,16 @@ void main() {
expect(tester.getSize(find.text('4')), equals(const Size(200.0, mainAxisExtent)));
});
testWidgets('SliverGridDelegateWithMaxCrossAxisExtent throws assertion error when maxCrossAxisExtent is 0', (WidgetTester tester) async {
const double maxCrossAxisExtent = 0;
expect(() => Directionality(
textDirection: TextDirection.ltr,
child: GridView.extent(
maxCrossAxisExtent: maxCrossAxisExtent,
),
), throwsA(isA<AssertionError>()));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment