From e36e9ca0e23ec2c66f3ac39699c45d069ff1f133 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 26 Aug 2022 15:10:24 -0700 Subject: [PATCH] nest list views for bad scroll (#110373) --- .../complex_layout/lib/src/app.dart | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/dev/benchmarks/complex_layout/lib/src/app.dart b/dev/benchmarks/complex_layout/lib/src/app.dart index d3950e4b745..1a544ed6b71 100644 --- a/dev/benchmarks/complex_layout/lib/src/app.dart +++ b/dev/benchmarks/complex_layout/lib/src/app.dart @@ -90,7 +90,23 @@ class ComplexLayout extends StatefulWidget { class ComplexLayoutState extends State { @override Widget build(BuildContext context) { - print(widget.badScroll); + Widget body = ListView.builder( + key: const Key('complex-scroll'), // this key is used by the driver test + controller: ScrollController(), // So that the scroll offset can be tracked + itemCount: widget.badScroll ? 500 : null, + shrinkWrap: widget.badScroll, + itemBuilder: (BuildContext context, int index) { + if (index.isEven) { + return FancyImageItem(index, key: PageStorageKey(index)); + } else { + return FancyGalleryItem(index, key: PageStorageKey(index)); + } + }, + ); + if (widget.badScroll) { + body = ListView(children: [body]); + } + return Scaffold( appBar: AppBar( title: const Text('Advanced Layout'), @@ -107,21 +123,7 @@ class ComplexLayoutState extends State { ), body: Column( children: [ - Expanded( - child: ListView.builder( - key: const Key('complex-scroll'), // this key is used by the driver test - controller: ScrollController(), // So that the scroll offset can be tracked - itemCount: widget.badScroll ? 500 : null, - shrinkWrap: widget.badScroll, - itemBuilder: (BuildContext context, int index) { - if (index.isEven) { - return FancyImageItem(index, key: PageStorageKey(index)); - } else { - return FancyGalleryItem(index, key: PageStorageKey(index)); - } - }, - ), - ), + Expanded(child: body), const BottomBar(), ], ),