Make bottom app bar safe area friendly (#16820)

This commit is contained in:
xster 2018-04-20 17:14:03 -07:00 committed by GitHub
parent 2eb290e718
commit 90ca815242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -106,7 +106,9 @@ class _BottomAppBarState extends State<BottomAppBar> {
color: widget.color ?? Theme.of(context).bottomAppBarColor,
child: new Material(
type: MaterialType.transparency,
child: widget.child,
child: widget.child == null
? null
: new SafeArea(child: widget.child),
),
);
}

View File

@ -125,6 +125,30 @@ void main() {
//
// Cannot test this before https://github.com/flutter/flutter/pull/14368
// as there is no way to make the FAB and BAB overlap.
testWidgets('observes safe area', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
home: const MediaQuery(
data: const MediaQueryData(
padding: const EdgeInsets.all(50.0),
),
child: const Scaffold(
bottomNavigationBar: const BottomAppBar(
child: const Center(
child: const Text('safe'),
),
),
),
),
),
);
expect(
tester.getBottomLeft(find.widgetWithText(Center, 'safe')),
const Offset(50.0, 550.0),
);
});
}
// The bottom app bar clip path computation is only available at paint time.