Remove deprecated PlatformMenuBar.body (#138509)

Part of https://github.com/flutter/flutter/issues/139243

## Description

This removes the `PlatformMenuBar.body` attribute and constructor parameter, since its deprecation period has elapsed.

## Tests
 - No tests were using the deprecated attribute, so no tests were removed.

#FlutterDeprecations
This commit is contained in:
Greg Spencer
2023-11-29 10:13:50 -08:00
committed by GitHub
parent 60d5c8abc5
commit 6295289163
8 changed files with 41 additions and 17 deletions

View File

@@ -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

View File

@@ -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<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();
}
}

View File

@@ -245,4 +245,7 @@ void main() {
clipBehavior: Clip.none,
);
final Clip clip = details.clipBehavior;
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
final Widget bodyValue = platformMenuBar.body;
}

View File

@@ -245,4 +245,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;
}

View File

@@ -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: <PlatformMenuItem>[], body: const SizedBox());
final Widget bodyValue = platformMenuBar.body;
}

View File

@@ -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: <PlatformMenuItem>[], child: const SizedBox());
final Widget bodyValue = platformMenuBar.child;
}

View File

@@ -170,4 +170,7 @@ void main() {
clipBehavior: Clip.none,
);
final Clip clip = details.clipBehavior;
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
final Widget bodyValue = platformMenuBar.body;
}

View File

@@ -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;
}