From 28907c7950f50dcc0bf80c539b5ca74e6149a8c6 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 2 Jan 2019 10:01:39 -0800 Subject: [PATCH] Make LicensePage respect the notch (#25799) --- packages/flutter/lib/src/material/about.dart | 11 +++++--- .../flutter/test/material/about_test.dart | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index 59f078dace..e9a1e3a334 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -472,10 +472,13 @@ class _LicensePageState extends State { context: context, child: DefaultTextStyle( style: Theme.of(context).textTheme.caption, - child: Scrollbar( - child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0), - children: contents, + child: SafeArea( + bottom: false, + child: Scrollbar( + child: ListView( + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0), + children: contents, + ), ), ), ), diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index f71ba902a3..4977be082c 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -108,4 +108,29 @@ void main() { expect(find.text('Another package'), findsOneWidget); expect(find.text('Another license'), findsOneWidget); }); + + testWidgets('LicensePage respects the notch', (WidgetTester tester) async { + const double safeareaPadding = 27.0; + + LicenseRegistry.addLicense(() { + return Stream.fromIterable([ + const LicenseEntryWithLineBreaks(['ABC'], 'DEF') + ]); + }); + + await tester.pumpWidget( + const MaterialApp( + home: MediaQuery( + data: MediaQueryData( + padding: EdgeInsets.all(safeareaPadding), + ), + child: LicensePage(), + ), + ), + ); + + await tester.pumpAndSettle(); + + expect(tester.getTopLeft(find.text('DEF')), const Offset(8.0 + safeareaPadding, 527.0)); + }); }