Fix sliver padding assertion failure that sometimes happens during startup because the app is temporarily built with zero size
This commit is contained in:
@@ -146,7 +146,7 @@ class RenderSliverPadding extends RenderSliver with RenderObjectWithChildMixin<R
|
||||
scrollOffset: math.max(0.0, constraints.scrollOffset - beforePadding),
|
||||
overlap: 0.0,
|
||||
remainingPaintExtent: constraints.remainingPaintExtent - calculatePaintOffset(constraints, from: 0.0, to: beforePadding),
|
||||
crossAxisExtent: constraints.crossAxisExtent - crossAxisPadding,
|
||||
crossAxisExtent: math.max(0.0, constraints.crossAxisExtent - crossAxisPadding),
|
||||
),
|
||||
parentUsesSize: true,
|
||||
);
|
||||
|
||||
@@ -156,6 +156,24 @@ void main() {
|
||||
expect(find.text('5'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('ListView can build out of overflow padding', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
new Center(
|
||||
child: new SizedBox(
|
||||
width: 0.0,
|
||||
height: 0.0,
|
||||
child: new ListView(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
children: <Widget>[
|
||||
const Text('padded'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.text('padded'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('ListView with itemExtent in unbounded context', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
new SingleChildScrollView(
|
||||
|
||||
Reference in New Issue
Block a user