diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index 6010b63a0a..81913f25c2 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -283,6 +283,7 @@ class _BottomSheetState extends State { if (constraints != null) { bottomSheet = Align( alignment: Alignment.bottomCenter, + heightFactor: 1.0, child: ConstrainedBox( constraints: constraints, child: bottomSheet, diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 7db0d42026..05845093e3 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -910,9 +910,10 @@ void main() { constraints: BoxConstraints(maxWidth: 80), ), ), - home: const Scaffold( - body: Center(child: Text('body')), - bottomSheet: Text('BottomSheet'), + home: Scaffold( + body: const Center(child: Text('body')), + bottomSheet: const Text('BottomSheet'), + floatingActionButton: FloatingActionButton(onPressed: () {}, child: const Icon(Icons.add)), ), )); expect(find.text('BottomSheet'), findsOneWidget); @@ -921,6 +922,12 @@ void main() { tester.getRect(find.text('BottomSheet')), const Rect.fromLTRB(360, 558, 440, 600), ); + // Ensure the FAB is overlapping the top of the sheet + expect(find.byIcon(Icons.add), findsOneWidget); + expect( + tester.getRect(find.byIcon(Icons.add)), + const Rect.fromLTRB(744, 544, 768, 568), + ); }); testWidgets('Theme constraints used for showBottomSheet', (WidgetTester tester) async {