Skip to content

Commit a07ad0b

Browse files
gspencergoogcaseycrogers
authored andcommitted
Remove deprecated PlatformMenuBar.body (flutter#138509)
Part of flutter#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
1 parent 1820f9b commit a07ad0b

File tree

8 files changed

+41
-17
lines changed

8 files changed

+41
-17
lines changed

packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,27 @@
2323
# * ListWheelScrollView: fix_list_wheel_scroll_view.yaml
2424
version: 1
2525
transforms:
26+
# Changes made in https://github.com/flutter/flutter/pull/138509
27+
- title: "Migrate to 'PlatformMenuBar.child'"
28+
date: 2023-11-15
29+
element:
30+
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
31+
field: 'body'
32+
inClass: 'PlatformMenuBar'
33+
changes:
34+
- kind: 'rename'
35+
newName: 'child'
36+
- title: "Migrate PlatformMenuBar(body:) to PlatformMenuBar(child:)"
37+
date: 2023-11-15
38+
element:
39+
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
40+
constructor: ''
41+
inClass: 'PlatformMenuBar'
42+
changes:
43+
- kind: 'renameParameter'
44+
oldName: 'body'
45+
newName: 'child'
46+
2647
# Changes made in https://github.com/flutter/flutter/pull/123352
2748
- title: "Migrate to 'rootElement'"
2849
date: 2023-03-13

packages/flutter/lib/src/widgets/platform_menu_bar.dart

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -438,28 +438,13 @@ class PlatformMenuBar extends StatefulWidget with DiagnosticableTreeMixin {
438438
super.key,
439439
required this.menus,
440440
this.child,
441-
@Deprecated(
442-
'Use the child attribute instead. '
443-
'This feature was deprecated after v3.1.0-0.0.pre.'
444-
)
445-
this.body,
446-
}) : assert(body == null || child == null,
447-
'The body argument is deprecated, and only one of body or child may be used.');
441+
});
448442

449443
/// The widget below this widget in the tree.
450444
///
451445
/// {@macro flutter.widgets.ProxyWidget.child}
452446
final Widget? child;
453447

454-
/// The widget below this widget in the tree.
455-
///
456-
/// This attribute is deprecated, use [child] instead.
457-
@Deprecated(
458-
'Use the child attribute instead. '
459-
'This feature was deprecated after v3.1.0-0.0.pre.'
460-
)
461-
final Widget? body;
462-
463448
/// The list of menu items that are the top level children of the
464449
/// [PlatformMenuBar].
465450
///
@@ -530,7 +515,7 @@ class _PlatformMenuBarState extends State<PlatformMenuBar> {
530515
Widget build(BuildContext context) {
531516
// PlatformMenuBar is really about managing the platform menu bar, and
532517
// doesn't do any rendering or event handling in Flutter.
533-
return widget.child ?? widget.body ?? const SizedBox();
518+
return widget.child ?? const SizedBox();
534519
}
535520
}
536521

packages/flutter/test_fixes/cupertino/cupertino.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,7 @@ void main() {
245245
clipBehavior: Clip.none,
246246
);
247247
final Clip clip = details.clipBehavior;
248+
249+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
250+
final Widget bodyValue = platformMenuBar.body;
248251
}

packages/flutter/test_fixes/cupertino/cupertino.dart.expect

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,7 @@ void main() {
245245
decorationClipBehavior: Clip.none,
246246
);
247247
final Clip clip = details.decorationClipBehavior;
248+
249+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], child: const SizedBox());
250+
final Widget bodyValue = platformMenuBar.child;
248251
}

packages/flutter/test_fixes/material/material.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,7 @@ void main() {
323323
// const Curve curve = standardEasing; expect Easing.legacy
324324
// const Curve curve = accelerateEasing; expect Easing.legacyAccelerate
325325
// const Curve curve = decelerateEasing; expect Easing.legacyDecelerate
326+
327+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
328+
final Widget bodyValue = platformMenuBar.body;
326329
}

packages/flutter/test_fixes/material/material.dart.expect

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,7 @@ void main() {
319319
// const Curve curve = standardEasing; expect Easing.legacy
320320
// const Curve curve = accelerateEasing; expect Easing.legacyAccelerate
321321
// const Curve curve = decelerateEasing; expect Easing.legacyDecelerate
322+
323+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], child: const SizedBox());
324+
final Widget bodyValue = platformMenuBar.child;
322325
}

packages/flutter/test_fixes/widgets/widgets.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,7 @@ void main() {
170170
clipBehavior: Clip.none,
171171
);
172172
final Clip clip = details.clipBehavior;
173+
174+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], body: const SizedBox());
175+
final Widget bodyValue = platformMenuBar.body;
173176
}

packages/flutter/test_fixes/widgets/widgets.dart.expect

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,7 @@ void main() {
170170
decorationClipBehavior: Clip.none,
171171
);
172172
final Clip clip = details.decorationClipBehavior;
173+
174+
final PlatformMenuBar platformMenuBar = PlatformMenuBar(menus: <PlatformMenuItem>[], child: const SizedBox());
175+
final Widget bodyValue = platformMenuBar.child;
173176
}

0 commit comments

Comments
 (0)