From a5262560d7c2f356b76bdfdf555b6b6af846bb52 Mon Sep 17 00:00:00 2001 From: Tong Mu Date: Fri, 5 Mar 2021 13:19:03 -0800 Subject: [PATCH] Revert "[showModalBottomSheet] fix: showModalBottomSheet does not move along keyboard (#71636)" (#77286) --- .../lib/src/material/bottom_sheet.dart | 33 ++++++++--------- .../test/material/bottom_sheet_test.dart | 35 ------------------- 2 files changed, 15 insertions(+), 53 deletions(-) diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index b6dd66c8b6b..0f926ac45e1 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -374,24 +374,21 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { return AnimatedBuilder( animation: widget.route!.animation!, - child: Padding( - padding: MediaQuery.of(context).viewInsets, - child: BottomSheet( - animationController: widget.route!._animationController, - onClosing: () { - if (widget.route!.isCurrent) { - Navigator.pop(context); - } - }, - builder: widget.route!.builder!, - backgroundColor: widget.backgroundColor, - elevation: widget.elevation, - shape: widget.shape, - clipBehavior: widget.clipBehavior, - enableDrag: widget.enableDrag, - onDragStart: handleDragStart, - onDragEnd: handleDragEnd, - ), + child: BottomSheet( + animationController: widget.route!._animationController, + onClosing: () { + if (widget.route!.isCurrent) { + Navigator.pop(context); + } + }, + builder: widget.route!.builder!, + backgroundColor: widget.backgroundColor, + elevation: widget.elevation, + shape: widget.shape, + clipBehavior: widget.clipBehavior, + enableDrag: widget.enableDrag, + onDragStart: handleDragStart, + onDragEnd: handleDragEnd, ), builder: (BuildContext context, Widget? child) { // Disable the initial animation when accessible navigation is on so diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 0b3ab197750..a6c20afb639 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -833,41 +833,6 @@ void main() { // The bottom sheet should not be showing any longer. expect(find.text('BottomSheet'), findsNothing); }); - - testWidgets('showModalBottomSheet should move along on-screen keyboard', - (WidgetTester tester) async { - late BuildContext savedContext; - - // Show a keyboard (simulate by space at the bottom of the screen). - await tester.pumpWidget( - MaterialApp( - home: MediaQuery( - data: const MediaQueryData(viewInsets: EdgeInsets.only(bottom: 200)), - child: Builder( - builder: (BuildContext context) { - savedContext = context; - return Container(); - }, - ), - ), - ), - ); - - await tester.pump(); - expect(find.text('BottomSheet'), findsNothing); - - showModalBottomSheet( - context: savedContext, - builder: (BuildContext context) { - return const Text('BottomSheet'); - }, - ); - - await tester.pumpAndSettle(); - - expect(find.text('BottomSheet'), findsOneWidget); - expect(tester.getBottomLeft(find.text('BottomSheet')).dy, 600); - }); } class _TestPage extends StatelessWidget {