diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/material3.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/material3.dart index 1ec8ae15bf..58ad370607 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/material3.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/material3.dart @@ -1579,7 +1579,7 @@ class BottomSheetSection extends StatefulWidget { class _BottomSheetSectionState extends State { bool isNonModalBottomSheetOpen = false; - PersistentBottomSheetController? _nonModalBottomSheetController; + PersistentBottomSheetController? _nonModalBottomSheetController; @override Widget build(BuildContext context) { @@ -1663,7 +1663,7 @@ class _BottomSheetSectionState extends State { }); } - _nonModalBottomSheetController = showBottomSheet( + _nonModalBottomSheetController = showBottomSheet( elevation: 8.0, context: context, constraints: const BoxConstraints(maxWidth: 640), diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart index 72ad23215f..33a6bc9973 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart @@ -265,7 +265,7 @@ class StockHomeState extends State { Navigator.pushNamed(context, '/stock', arguments: stock.symbol); }, onShow: (Stock stock) { - _scaffoldKey.currentState!.showBottomSheet((BuildContext context) => StockSymbolBottomSheet(stock: stock)); + _scaffoldKey.currentState!.showBottomSheet((BuildContext context) => StockSymbolBottomSheet(stock: stock)); }, ); } diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/list_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/list_demo.dart index 527b0fa9d6..bea1afc025 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/list_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/list_demo.dart @@ -32,7 +32,7 @@ class ListDemo extends StatefulWidget { class _ListDemoState extends State { static final GlobalKey scaffoldKey = GlobalKey(); - PersistentBottomSheetController? _bottomSheet; + PersistentBottomSheetController? _bottomSheet; _MaterialListType? _itemType = _MaterialListType.threeLine; bool? _dense = false; bool? _showAvatars = true; @@ -51,7 +51,7 @@ class _ListDemoState extends State { } void _showConfigurationSheet() { - final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((BuildContext bottomSheetContext) { + final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((BuildContext bottomSheetContext) { return Container( decoration: const BoxDecoration( border: Border(top: BorderSide(color: Colors.black26)), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart index fa8ff9207b..4d1f81c612 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart @@ -30,7 +30,7 @@ class _PersistentBottomSheetDemoState extends State { setState(() { // disable the button _showBottomSheetCallback = null; }); - _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { final ThemeData themeData = Theme.of(context); return Container( decoration: BoxDecoration( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart index 375ec45136..47fffa587c 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart @@ -37,7 +37,7 @@ class _ListItem { class _ListDemoState extends State { static final GlobalKey scaffoldKey = GlobalKey(); - PersistentBottomSheetController? _bottomSheet; + PersistentBottomSheetController? _bottomSheet; _ReorderableListType? _itemType = _ReorderableListType.threeLine; bool? _reverse = false; bool _reverseSort = false; @@ -71,7 +71,7 @@ class _ListDemoState extends State { void _showConfigurationSheet() { setState(() { - _bottomSheet = scaffoldKey.currentState!.showBottomSheet((BuildContext bottomSheetContext) { + _bottomSheet = scaffoldKey.currentState!.showBottomSheet((BuildContext bottomSheetContext) { return DecoratedBox( decoration: const BoxDecoration( border: Border(top: BorderSide(color: Colors.black26)), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart index a9887ece89..656bac759c 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart @@ -71,7 +71,7 @@ class _TabsFabDemoState extends State with SingleTickerProviderStat } void _showExplanatoryText() { - _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return Container( decoration: BoxDecoration( border: Border(top: BorderSide(color: Theme.of(context).dividerColor)) diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart index feeef35796..db9a31e234 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.2.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.2.dart @@ -220,7 +220,7 @@ class RootPage extends StatelessWidget { return ElevatedButton( style: buttonStyle, onPressed: () { - showBottomSheet( + showBottomSheet( context: context, builder: (BuildContext context) { return Container( diff --git a/examples/api/lib/material/scaffold/scaffold.of.0.dart b/examples/api/lib/material/scaffold/scaffold.of.0.dart index 88eb72ff35..e720538f69 100644 --- a/examples/api/lib/material/scaffold/scaffold.of.0.dart +++ b/examples/api/lib/material/scaffold/scaffold.of.0.dart @@ -36,7 +36,7 @@ class MyScaffoldBody extends StatelessWidget { child: ElevatedButton( child: const Text('SHOW BOTTOM SHEET'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) { return Container( alignment: Alignment.center, diff --git a/examples/api/lib/material/scaffold/scaffold.of.1.dart b/examples/api/lib/material/scaffold/scaffold.of.1.dart index 10fd675df6..103df16f0f 100644 --- a/examples/api/lib/material/scaffold/scaffold.of.1.dart +++ b/examples/api/lib/material/scaffold/scaffold.of.1.dart @@ -34,7 +34,7 @@ class OfExample extends StatelessWidget { child: ElevatedButton( child: const Text('SHOW BOTTOM SHEET'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) { return Container( alignment: Alignment.center, diff --git a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart index c84cd0e6d2..3bda005f95 100644 --- a/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart +++ b/examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart @@ -31,7 +31,7 @@ class ShowBottomSheetExample extends StatelessWidget { child: ElevatedButton( child: const Text('showBottomSheet'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) { return Container( height: 200, diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index 4058a724c5..2da6e9a9ea 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -1324,7 +1324,7 @@ Future showModalBottomSheet({ /// * [Scaffold.of], for information about how to obtain the [BuildContext]. /// * The Material 2 spec at . /// * The Material 3 spec at . -PersistentBottomSheetController showBottomSheet({ +PersistentBottomSheetController showBottomSheet({ required BuildContext context, required WidgetBuilder builder, Color? backgroundColor, @@ -1337,7 +1337,7 @@ PersistentBottomSheetController showBottomSheet({ }) { assert(debugCheckHasScaffold(context)); - return Scaffold.of(context).showBottomSheet( + return Scaffold.of(context).showBottomSheet( builder, backgroundColor: backgroundColor, elevation: elevation, diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 1f90b7d37a..0a09824938 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -2121,7 +2121,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto /// appropriate [IconButton], and handles the edge-swipe gesture, to show the /// drawer. /// - /// To close the drawer, use either [ScaffoldState.closeEndDrawer] or + /// To close the drawer, use either [ScaffoldState.closeDrawer] or /// [Navigator.pop]. /// /// See [Scaffold.of] for information about how to obtain the [ScaffoldState]. @@ -2196,7 +2196,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto // Important if the app/user takes an action that could repeatedly show a // bottom sheet. final List<_StandardBottomSheet> _dismissedBottomSheets = <_StandardBottomSheet>[]; - PersistentBottomSheetController? _currentBottomSheet; + PersistentBottomSheetController? _currentBottomSheet; final GlobalKey _currentBottomSheetKey = GlobalKey(); LocalHistoryEntry? _persistentSheetHistoryEntry; @@ -2234,7 +2234,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto assert(_dismissedBottomSheets.isEmpty); } - _currentBottomSheet = _buildBottomSheet( + _currentBottomSheet = _buildBottomSheet( (BuildContext context) { return NotificationListener( onNotification: persistentBottomSheetExtentChanged, @@ -2290,7 +2290,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto _currentBottomSheetKey.currentState!.setState(() {}); } - PersistentBottomSheetController _buildBottomSheet( + PersistentBottomSheetController _buildBottomSheet( WidgetBuilder builder, { required bool isPersistent, required AnimationController animationController, @@ -2313,7 +2313,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto return true; }()); - final Completer completer = Completer(); + final Completer completer = Completer(); final GlobalKey<_StandardBottomSheetState> bottomSheetKey = GlobalKey<_StandardBottomSheetState>(); late _StandardBottomSheet bottomSheet; @@ -2351,10 +2351,6 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto if (animationController.status != AnimationStatus.dismissed) { _dismissedBottomSheets.add(bottomSheet); } - // TODO(srawlins): Ensure that this Completer has a nullable type (or more - // likely, `void`). - // https://github.com/flutter/flutter/issues/137294). - // ignore: null_argument_to_non_null_type completer.complete(); } @@ -2412,7 +2408,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto ModalRoute.of(context)!.addLocalHistoryEntry(entry!); } - return PersistentBottomSheetController._( + return PersistentBottomSheetController._( bottomSheet, completer, entry != null @@ -2471,7 +2467,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto /// * [Scaffold.of], for information about how to obtain the [ScaffoldState]. /// * The Material 2 spec at . /// * The Material 3 spec at . - PersistentBottomSheetController showBottomSheet( + PersistentBottomSheetController showBottomSheet( WidgetBuilder builder, { Color? backgroundColor, double? elevation, @@ -2496,7 +2492,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto _closeCurrentBottomSheet(); final AnimationController controller = (transitionAnimationController ?? BottomSheet.createAnimationController(this))..forward(); setState(() { - _currentBottomSheet = _buildBottomSheet( + _currentBottomSheet = _buildBottomSheet( builder, isPersistent: false, animationController: controller, @@ -2509,7 +2505,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto shouldDisposeAnimationController: transitionAnimationController == null, ); }); - return _currentBottomSheet! as PersistentBottomSheetController; + return _currentBottomSheet!; } // Floating Action Button API @@ -3274,7 +3270,7 @@ class _StandardBottomSheetState extends State<_StandardBottomSheet> { /// This controller is used to display both standard and persistent bottom /// sheets. A bottom sheet is only persistent if it is set as the /// [Scaffold.bottomSheet]. -class PersistentBottomSheetController extends ScaffoldFeatureController<_StandardBottomSheet, T> { +class PersistentBottomSheetController extends ScaffoldFeatureController<_StandardBottomSheet, void> { const PersistentBottomSheetController._( super.widget, super.completer, diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 45b9cf7a07..0480896bb0 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -2178,7 +2178,7 @@ typedef ConditionalElementVisitor = bool Function(Element element); /// return TextButton( /// child: const Text('BUTTON'), /// onPressed: () { -/// Scaffold.of(context).showBottomSheet( +/// Scaffold.of(context).showBottomSheet( /// (BuildContext context) { /// return Container( /// alignment: Alignment.center, diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 183c2aa600..5b6aafafff 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -106,7 +106,7 @@ void main() { expect(showBottomSheetThenCalled, isFalse); expect(find.text('BottomSheet'), findsNothing); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return const SizedBox( height: 200.0, child: Text('BottomSheet'), @@ -141,7 +141,7 @@ void main() { expect(showBottomSheetThenCalled, isFalse); expect(find.text('BottomSheet'), findsNothing); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return const SizedBox( height: 200.0, child: Text('BottomSheet'), @@ -178,7 +178,7 @@ void main() { expect(showBottomSheetThenCalled, isFalse); expect(find.text('BottomSheet'), findsNothing); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return const SizedBox( height: 200.0, child: Text('BottomSheet'), @@ -216,7 +216,7 @@ void main() { expect(buildCount, 0); expect(find.text('BottomSheet'), findsNothing); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { buildCount++; return const SizedBox( height: 200.0, @@ -618,7 +618,7 @@ void main() { expect(showBottomSheetThenCalled, isFalse); expect(find.text('BottomSheet'), findsNothing); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return Container( margin: const EdgeInsets.all(40.0), child: const Text('BottomSheet'), @@ -672,7 +672,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return Container( margin: const EdgeInsets.all(40.0), child: const Text('BottomSheet'), @@ -1482,7 +1482,7 @@ void main() { return GestureDetector( key: tapTarget, onTap: () { - showBottomSheet( + showBottomSheet( context: context, // The default duration and reverseDuration is 1 second transitionAnimationController: controller, @@ -1539,7 +1539,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((_) { + scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { return Container(height: 200.0); @@ -1553,7 +1553,7 @@ void main() { // The first sheet's animation is still running. // Trigger the second sheet will remove the first sheet from tree. - scaffoldKey.currentState!.showBottomSheet((_) { + scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { return Container(height: 200.0); @@ -1575,7 +1575,7 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/99627 testWidgetsWithLeakTracking('The old route entry should be removed when a new sheet popup', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); - PersistentBottomSheetController? sheetController; + PersistentBottomSheetController? sheetController; await tester.pumpWidget(MaterialApp( home: Scaffold( @@ -1587,7 +1587,7 @@ void main() { final ModalRoute route = ModalRoute.of(scaffoldKey.currentContext!)!; expect(route.canPop, false); - scaffoldKey.currentState!.showBottomSheet((_) { + scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { return Container(height: 200.0); @@ -1600,7 +1600,7 @@ void main() { expect(route.canPop, true); // Trigger the second sheet will remove the first sheet from tree. - sheetController = scaffoldKey.currentState!.showBottomSheet((_) { + sheetController = scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { return Container(height: 200.0); @@ -1632,7 +1632,7 @@ void main() { return GestureDetector( key: tapTarget, onTap: () { - showBottomSheet( + showBottomSheet( context: context, transitionAnimationController: controller, builder: (BuildContext context) { @@ -1675,7 +1675,7 @@ void main() { testWidgetsWithLeakTracking('Calling PersistentBottomSheetController.close does not crash when it is not the current bottom sheet', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/93717 - PersistentBottomSheetController? sheetController1; + PersistentBottomSheetController? sheetController1; await tester.pumpWidget(MaterialApp( home: Scaffold( body: Builder(builder: (BuildContext context) { @@ -1685,7 +1685,7 @@ void main() { ElevatedButton( child: const Text('show 1'), onPressed: () { - sheetController1 = Scaffold.of(context).showBottomSheet( + sheetController1 = Scaffold.of(context).showBottomSheet( (BuildContext context) => const Text('BottomSheet 1'), ); }, @@ -1693,7 +1693,7 @@ void main() { ElevatedButton( child: const Text('show 2'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) => const Text('BottomSheet 2'), ); }, @@ -1914,7 +1914,7 @@ void main() { child: ElevatedButton( child: const Text('Press me'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) => const Text('BottomSheet'), ); }, @@ -2033,7 +2033,7 @@ void main() { child: ElevatedButton( child: const Text('Press me'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) => const Text('BottomSheet'), ); }, @@ -2102,7 +2102,7 @@ void main() { child: ElevatedButton( child: const Text('Press me'), onPressed: () { - Scaffold.of(context).showBottomSheet( + Scaffold.of(context).showBottomSheet( (BuildContext context) => const Text('BottomSheet'), constraints: const BoxConstraints(maxWidth: sheetMaxWidth), ); diff --git a/packages/flutter/test/material/bottom_sheet_theme_test.dart b/packages/flutter/test/material/bottom_sheet_theme_test.dart index 742753da56..904db91fbb 100644 --- a/packages/flutter/test/material/bottom_sheet_theme_test.dart +++ b/packages/flutter/test/material/bottom_sheet_theme_test.dart @@ -397,7 +397,7 @@ Widget bottomSheetWithElevations(BottomSheetThemeData bottomSheetTheme, {bool us RawMaterialButton( child: const Text('Show Persistent'), onPressed: () { - showBottomSheet( + showBottomSheet( context: context, builder: (BuildContext _) { return const Text( diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index 780f19c2b3..45d7ff879d 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -97,7 +97,7 @@ void main() { ), home: Builder( builder: (BuildContext context) { - showBottomSheet( + showBottomSheet( context: context, builder: (BuildContext context) => Container(), ); diff --git a/packages/flutter/test/material/persistent_bottom_sheet_test.dart b/packages/flutter/test/material/persistent_bottom_sheet_test.dart index e4f7520e02..aaa9636497 100644 --- a/packages/flutter/test/material/persistent_bottom_sheet_test.dart +++ b/packages/flutter/test/material/persistent_bottom_sheet_test.dart @@ -107,7 +107,7 @@ void main() { ), )); - final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((_) { + final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { buildCount += 1; @@ -164,7 +164,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return ListView( shrinkWrap: true, primary: false, @@ -196,7 +196,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return DraggableScrollableSheet( expand: false, shouldCloseOnMinExtent: false, @@ -234,7 +234,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return ListView( shrinkWrap: true, primary: false, @@ -269,7 +269,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet( + scaffoldKey.currentState!.showBottomSheet( (BuildContext context) { return DraggableScrollableSheet( expand: false, @@ -423,7 +423,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet( + scaffoldKey.currentState!.showBottomSheet( (BuildContext context) { return DraggableScrollableSheet( expand: false, @@ -472,7 +472,7 @@ void main() { )); int buildCount = 0; - showBottomSheet( + showBottomSheet( context: key.currentContext!, builder: (BuildContext context) { return Builder( @@ -510,7 +510,7 @@ void main() { await tester.pump(); - showBottomSheet( + showBottomSheet( context: scaffoldContext, builder: (BuildContext context) { bottomSheetContext = context; @@ -627,7 +627,7 @@ void main() { ), )); - scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return ListView( shrinkWrap: true, primary: false, @@ -657,7 +657,7 @@ void main() { ), )); - final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((_) { + final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState!.showBottomSheet((_) { return Builder( builder: (BuildContext context) { return Container(height: 200.0); diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index 0fbc945087..8476d4f0e3 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -596,7 +596,7 @@ void main() { builder: (BuildContext context) { return GestureDetector( onTap: () { - Scaffold.of(context).showBottomSheet((BuildContext context) { + Scaffold.of(context).showBottomSheet((BuildContext context) { return Container( key: sheetKey, color: Colors.blue[500], @@ -2173,7 +2173,7 @@ void main() { ); late FlutterError error; try { - key.currentState!.showBottomSheet((BuildContext context) { + key.currentState!.showBottomSheet((BuildContext context) { final ThemeData themeData = Theme.of(context); return Container( decoration: BoxDecoration( @@ -2234,7 +2234,7 @@ void main() { ), ), ); - key.currentState!.showBottomSheet((_) => Container()); + key.currentState!.showBottomSheet((_) => Container()); await tester.tap(find.byKey(buttonKey)); await tester.pump(); expect(errors, isNotEmpty); @@ -2266,7 +2266,7 @@ void main() { MaterialApp( home: Builder( builder: (BuildContext context) { - Scaffold.of(context).showBottomSheet((BuildContext context) { + Scaffold.of(context).showBottomSheet((BuildContext context) { return Container(); }); return Container(); @@ -2766,7 +2766,7 @@ void main() { final DraggableScrollableController draggableController = DraggableScrollableController(); addTearDown(draggableController.dispose); final GlobalKey scaffoldKey = GlobalKey(); - PersistentBottomSheetController? sheetController; + PersistentBottomSheetController? sheetController; await tester.pumpWidget(MaterialApp( home: Scaffold( @@ -2775,7 +2775,7 @@ void main() { ), )); - sheetController = scaffoldKey.currentState!.showBottomSheet((_) { + sheetController = scaffoldKey.currentState!.showBottomSheet((_) { return DraggableScrollableSheet( expand: false, controller: draggableController, @@ -2811,7 +2811,7 @@ void main() { testWidgetsWithLeakTracking("Closing bottom sheet & removing FAB at the same time doesn't throw assertion", (WidgetTester tester) async { final Key bottomSheetKey = UniqueKey(); - PersistentBottomSheetController? controller; + PersistentBottomSheetController? controller; bool show = true; await tester.pumpWidget(StatefulBuilder( diff --git a/packages/flutter/test/widgets/page_transitions_test.dart b/packages/flutter/test/widgets/page_transitions_test.dart index 6b1a973ea4..cc80313950 100644 --- a/packages/flutter/test/widgets/page_transitions_test.dart +++ b/packages/flutter/test/widgets/page_transitions_test.dart @@ -28,7 +28,7 @@ class PersistentBottomSheetTestState extends State { bool setStateCalled = false; void showBottomSheet() { - _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { + _scaffoldKey.currentState!.showBottomSheet((BuildContext context) { return const Text('bottomSheet'); }) .closed.whenComplete(() {