From 2c0c9ba9e5a192aefb1925fbcce44344d4b681d5 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 15 Dec 2017 12:46:35 -0800 Subject: [PATCH] Apply media padding in complex layout benchmark drawer header (#13610) By default BoxScrollView (and hence ListView, which is a subclass) padding is the media padding along its scroll axis in order to avoid placing list items within areas where user interaction should be minimised -- e.g. under the status bar, or in and around the iPhone X notch in landscape mode. In cases where a list item should occupy the padding area, developers should set the ListView padding to EdgeInsets.zero so as not to pick up the default media padding. For widgets inside the drawer that should avoid safe areas, developers can add a SafeArea widget. --- dev/benchmarks/complex_layout/lib/main.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index 27bd8c1a24..215a602db5 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -610,8 +610,12 @@ class GalleryDrawer extends StatelessWidget { Widget build(BuildContext context) { final ScrollMode currentMode = ComplexLayoutApp.of(context).scrollMode; return new Drawer( + // Note: for real apps, see the Gallery material Drawer demo. More + // typically, a drawer would have a fixed header with a scrolling body + // below it. child: new ListView( key: const PageStorageKey('gallery-drawer'), + padding: EdgeInsets.zero, children: [ new FancyDrawerHeader(), new ListTile( @@ -664,6 +668,10 @@ class FancyDrawerHeader extends StatelessWidget { return new Container( color: Colors.purple, height: 200.0, + child: const SafeArea( + bottom: false, + child: const Placeholder(), + ), ); } }