Unverified Commit 90ca8152 authored by xster's avatar xster Committed by GitHub

Make bottom app bar safe area friendly (#16820)

parent 2eb290e7
...@@ -106,7 +106,9 @@ class _BottomAppBarState extends State<BottomAppBar> { ...@@ -106,7 +106,9 @@ class _BottomAppBarState extends State<BottomAppBar> {
color: widget.color ?? Theme.of(context).bottomAppBarColor, color: widget.color ?? Theme.of(context).bottomAppBarColor,
child: new Material( child: new Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: widget.child, child: widget.child == null
? null
: new SafeArea(child: widget.child),
), ),
); );
} }
......
...@@ -125,6 +125,30 @@ void main() { ...@@ -125,6 +125,30 @@ void main() {
// //
// Cannot test this before https://github.com/flutter/flutter/pull/14368 // Cannot test this before https://github.com/flutter/flutter/pull/14368
// as there is no way to make the FAB and BAB overlap. // 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. // The bottom app bar clip path computation is only available at paint time.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment