Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated PlatformMenuBar.body #138509

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 2 additions & 17 deletions packages/flutter/lib/src/widgets/platform_menu_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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].
///
Expand Down Expand Up @@ -530,7 +515,7 @@ class _PlatformMenuBarState extends State<PlatformMenuBar> {
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();
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/flutter/test_fixes/widgets/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,7 @@ void main() {
clipBehavior: Clip.none,
);
final Clip clip = details.clipBehavior;

gspencergoog marked this conversation as resolved.
Show resolved Hide resolved
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
final Widget bodyValue = platformMenuBar.body;
}
3 changes: 3 additions & 0 deletions packages/flutter/test_fixes/widgets/widgets.dart.expect
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,7 @@ void main() {
decorationClipBehavior: Clip.none,
);
final Clip clip = details.decorationClipBehavior;

final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], child: const SizedBox());
final Widget bodyValue = platformMenuBar.child;
}