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:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user