File tree 2 files changed +27
-1
lines changed 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -128,8 +128,9 @@ class _BottomAppBarState extends State<BottomAppBar> {
128
128
@override
129
129
Widget build (BuildContext context) {
130
130
final BottomAppBarTheme babTheme = BottomAppBarTheme .of (context);
131
+ final bool hasFab = Scaffold .of (context).hasFloatingActionButton;
131
132
final NotchedShape ? notchedShape = widget.shape ?? babTheme.shape;
132
- final CustomClipper <Path > clipper = notchedShape != null
133
+ final CustomClipper <Path > clipper = notchedShape != null && hasFab
133
134
? _BottomAppBarClipper (
134
135
geometry: geometryListenable,
135
136
shape: notchedShape,
Original file line number Diff line number Diff line change @@ -474,6 +474,31 @@ void main() {
474
474
),
475
475
);
476
476
});
477
+
478
+ testWidgets ('BottomAppBar does not apply custom clipper without FAB' , (WidgetTester tester) async {
479
+ Widget buildWidget ({Widget ? fab}) {
480
+ return MaterialApp (
481
+ home: Scaffold (
482
+ floatingActionButtonLocation: FloatingActionButtonLocation .centerDocked,
483
+ floatingActionButton: fab,
484
+ bottomNavigationBar: BottomAppBar (
485
+ color: Colors .green,
486
+ shape: const CircularNotchedRectangle (),
487
+ child: Container (height: 50 ),
488
+ ),
489
+ ),
490
+ );
491
+ }
492
+ await tester.pumpWidget (buildWidget (fab: FloatingActionButton (onPressed: () { })));
493
+
494
+ PhysicalShape physicalShape = tester.widget (find.byType (PhysicalShape ).at (0 ));
495
+ expect (physicalShape.clipper.toString (), '_BottomAppBarClipper' );
496
+
497
+ await tester.pumpWidget (buildWidget ());
498
+
499
+ physicalShape = tester.widget (find.byType (PhysicalShape ).at (0 ));
500
+ expect (physicalShape.clipper.toString (), 'ShapeBorderClipper' );
501
+ });
477
502
}
478
503
479
504
// The bottom app bar clip path computation is only available at paint time.
You can’t perform that action at this time.
0 commit comments