Make bottom app bar safe area friendly (#16820)
This commit is contained in:
parent
2eb290e718
commit
90ca815242
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user