Fixed a problem with the FAB position if a maximum width was set on the bottom sheet of a scaffold. (#82234)

This commit is contained in:
Darren Austin
2021-05-13 13:04:04 -07:00
committed by GitHub
parent a1fa62ad6f
commit 567267969d
2 changed files with 11 additions and 3 deletions

View File

@@ -283,6 +283,7 @@ class _BottomSheetState extends State<BottomSheet> {
if (constraints != null) {
bottomSheet = Align(
alignment: Alignment.bottomCenter,
heightFactor: 1.0,
child: ConstrainedBox(
constraints: constraints,
child: bottomSheet,

View File

@@ -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 {