diff --git a/packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml b/packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml index 42692a91f0..681ab198ce 100644 --- a/packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml +++ b/packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml @@ -23,6 +23,27 @@ # * ListWheelScrollView: fix_list_wheel_scroll_view.yaml version: 1 transforms: + # Changes made in https://github.com/flutter/flutter/pull/138509 + - title: "Migrate to 'PlatformMenuBar.child'" + date: 2023-11-15 + element: + uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ] + field: 'body' + inClass: 'PlatformMenuBar' + changes: + - kind: 'rename' + newName: 'child' + - title: "Migrate PlatformMenuBar(body:) to PlatformMenuBar(child:)" + date: 2023-11-15 + element: + uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ] + constructor: '' + inClass: 'PlatformMenuBar' + changes: + - kind: 'renameParameter' + oldName: 'body' + newName: 'child' + # Changes made in https://github.com/flutter/flutter/pull/123352 - title: "Migrate to 'rootElement'" date: 2023-03-13 diff --git a/packages/flutter/lib/src/widgets/platform_menu_bar.dart b/packages/flutter/lib/src/widgets/platform_menu_bar.dart index 30e3066f47..687894d378 100644 --- a/packages/flutter/lib/src/widgets/platform_menu_bar.dart +++ b/packages/flutter/lib/src/widgets/platform_menu_bar.dart @@ -438,28 +438,13 @@ class PlatformMenuBar extends StatefulWidget with DiagnosticableTreeMixin { super.key, required this.menus, this.child, - @Deprecated( - 'Use the child attribute instead. ' - 'This feature was deprecated after v3.1.0-0.0.pre.' - ) - this.body, - }) : assert(body == null || child == null, - 'The body argument is deprecated, and only one of body or child may be used.'); + }); /// The widget below this widget in the tree. /// /// {@macro flutter.widgets.ProxyWidget.child} final Widget? child; - /// The widget below this widget in the tree. - /// - /// This attribute is deprecated, use [child] instead. - @Deprecated( - 'Use the child attribute instead. ' - 'This feature was deprecated after v3.1.0-0.0.pre.' - ) - final Widget? body; - /// The list of menu items that are the top level children of the /// [PlatformMenuBar]. /// @@ -530,7 +515,7 @@ class _PlatformMenuBarState extends State { Widget build(BuildContext context) { // PlatformMenuBar is really about managing the platform menu bar, and // doesn't do any rendering or event handling in Flutter. - return widget.child ?? widget.body ?? const SizedBox(); + return widget.child ?? const SizedBox(); } } diff --git a/packages/flutter/test_fixes/cupertino/cupertino.dart b/packages/flutter/test_fixes/cupertino/cupertino.dart index c5b5a625c4..d35c32634b 100644 --- a/packages/flutter/test_fixes/cupertino/cupertino.dart +++ b/packages/flutter/test_fixes/cupertino/cupertino.dart @@ -245,4 +245,7 @@ void main() { clipBehavior: Clip.none, ); final Clip clip = details.clipBehavior; + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], body: const SizedBox()); + final Widget bodyValue = platformMenuBar.body; } diff --git a/packages/flutter/test_fixes/cupertino/cupertino.dart.expect b/packages/flutter/test_fixes/cupertino/cupertino.dart.expect index e4e4c7b22b..a12dd1bb35 100644 --- a/packages/flutter/test_fixes/cupertino/cupertino.dart.expect +++ b/packages/flutter/test_fixes/cupertino/cupertino.dart.expect @@ -245,4 +245,7 @@ void main() { decorationClipBehavior: Clip.none, ); final Clip clip = details.decorationClipBehavior; + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], child: const SizedBox()); + final Widget bodyValue = platformMenuBar.child; } diff --git a/packages/flutter/test_fixes/material/material.dart b/packages/flutter/test_fixes/material/material.dart index 7fa4f903e5..3afb419e54 100644 --- a/packages/flutter/test_fixes/material/material.dart +++ b/packages/flutter/test_fixes/material/material.dart @@ -323,4 +323,7 @@ void main() { // const Curve curve = standardEasing; expect Easing.legacy // const Curve curve = accelerateEasing; expect Easing.legacyAccelerate // const Curve curve = decelerateEasing; expect Easing.legacyDecelerate + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], body: const SizedBox()); + final Widget bodyValue = platformMenuBar.body; } diff --git a/packages/flutter/test_fixes/material/material.dart.expect b/packages/flutter/test_fixes/material/material.dart.expect index f651596145..1c475a47f5 100644 --- a/packages/flutter/test_fixes/material/material.dart.expect +++ b/packages/flutter/test_fixes/material/material.dart.expect @@ -319,4 +319,7 @@ void main() { // const Curve curve = standardEasing; expect Easing.legacy // const Curve curve = accelerateEasing; expect Easing.legacyAccelerate // const Curve curve = decelerateEasing; expect Easing.legacyDecelerate + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], child: const SizedBox()); + final Widget bodyValue = platformMenuBar.child; } diff --git a/packages/flutter/test_fixes/widgets/widgets.dart b/packages/flutter/test_fixes/widgets/widgets.dart index 0ba50ed692..e6fa0b2b60 100644 --- a/packages/flutter/test_fixes/widgets/widgets.dart +++ b/packages/flutter/test_fixes/widgets/widgets.dart @@ -170,4 +170,7 @@ void main() { clipBehavior: Clip.none, ); final Clip clip = details.clipBehavior; + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], body: const SizedBox()); + final Widget bodyValue = platformMenuBar.body; } diff --git a/packages/flutter/test_fixes/widgets/widgets.dart.expect b/packages/flutter/test_fixes/widgets/widgets.dart.expect index a74fa0e7c5..537af7d04f 100644 --- a/packages/flutter/test_fixes/widgets/widgets.dart.expect +++ b/packages/flutter/test_fixes/widgets/widgets.dart.expect @@ -170,4 +170,7 @@ void main() { decorationClipBehavior: Clip.none, ); final Clip clip = details.decorationClipBehavior; + + final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: [], child: const SizedBox()); + final Widget bodyValue = platformMenuBar.child; }