Skip to content

Commit

Permalink
Remove deprecated PlatformMenuBar.body (flutter#138509)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gspencergoog authored and caseycrogers committed Dec 29, 2023
1 parent 1820f9b commit a07ad0b
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 17 deletions.
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/cupertino/cupertino.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions packages/flutter/test_fixes/cupertino/cupertino.dart.expect
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions packages/flutter/test_fixes/material/material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions packages/flutter/test_fixes/material/material.dart.expect
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
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;

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

0 comments on commit a07ad0b

Please sign in to comment.