-
Notifications
You must be signed in to change notification settings - Fork 29.7k
fix MenuItemButton if child is null #147485
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
Conversation
| hasSubmenu: false, | ||
| overflowAxis: _anchor?._orientation ?? widget.overflowAxis, | ||
| child: widget.child!, | ||
| child: widget.child ?? const SizedBox(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using const SizedBox.shrink(); Would be better.
See https://api.flutter.dev/flutter/widgets/Visibility-class.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahmoudsaleh1997 Agreed, thank you
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a bunch for the contribution! Looking forward to getting this bug fixed.
| hasSubmenu: false, | ||
| overflowAxis: _anchor?._orientation ?? widget.overflowAxis, | ||
| child: widget.child!, | ||
| child: widget.child ?? const SizedBox.shrink(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than just a one-line change here, would you be able to update _MenuItemLabel so it has a nullable child property? Currently it's still documented as being required:
const _MenuItemLabel({
required this.hasSubmenu,
this.showDecoration = true,
this.leadingIcon,
this.trailingIcon,
this.shortcut,
this.semanticsLabel,
this.overflowAxis = Axis.vertical,
required this.child,
});
/// The required label child widget.
final Widget child;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nate-thegrate Thank you for your review,i have updated~
| ); | ||
| }); | ||
|
|
||
| testWidgets('MenuItemButton is null check operator when it child is null', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| testWidgets('MenuItemButton is null check operator when it child is null', (WidgetTester tester) async { | |
| testWidgets('MenuItemButton can build when its child is null', (WidgetTester tester) async { |
The rest of this test looks fantastic!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nate-thegrate Thank you for your review,i got it~
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Fantastic work here, thank you!
gspencergoog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flutter/flutter@04424e1...7920a52 2024-05-07 [email protected] Add tests for callback_shortcuts.0.dart API example. (flutter/flutter#147536) 2024-05-07 [email protected] Improve Android SDK and NDK mistmatch warning message (flutter/flutter#147809) 2024-05-07 [email protected] Add tests for shortcuts.dart API examples. (flutter/flutter#147433) 2024-05-07 [email protected] Added missing tests for ButtonStyle example (flutter/flutter#147457) 2024-05-07 [email protected] Roll Flutter Engine from ece1d686e3ba to 150f694a7816 (1 revision) (flutter/flutter#147912) 2024-05-07 [email protected] DropdownMenu cleanup (flutter/flutter#147860) 2024-05-07 [email protected] Roll Flutter Engine from 80470584e1e1 to ece1d686e3ba (1 revision) (flutter/flutter#147910) 2024-05-07 [email protected] Roll Flutter Engine from b7bfd94af743 to 80470584e1e1 (1 revision) (flutter/flutter#147906) 2024-05-07 [email protected] Roll Flutter Engine from b64e2300bcd0 to b7bfd94af743 (1 revision) (flutter/flutter#147905) 2024-05-07 [email protected] fix MenuItemButton if child is null (flutter/flutter#147485) 2024-05-07 [email protected] Fix document generation, eliminate template support from snippets tool. (flutter/flutter#147893) 2024-05-07 [email protected] Roll Flutter Engine from 4cb9e02c06ce to b64e2300bcd0 (1 revision) (flutter/flutter#147904) 2024-05-07 [email protected] test focus example 0 (flutter/flutter#147564) 2024-05-07 [email protected] Roll Flutter Engine from 422f92b992c5 to 4cb9e02c06ce (1 revision) (flutter/flutter#147899) 2024-05-06 [email protected] Roll pub packages (flutter/flutter#147896) 2024-05-06 [email protected] Roll Flutter Engine from 463ff7d2d4d5 to 422f92b992c5 (5 revisions) (flutter/flutter#147895) 2024-05-06 [email protected] MultiSelectableSelectionContainerDelegate documentation fixes. (flutter/flutter#147843) 2024-05-06 [email protected] Roll pub packages (flutter/flutter#147891) 2024-05-06 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.4 to 4.1.5 (flutter/flutter#147888) 2024-05-06 [email protected] Fix janks and memory leaks in `CupertinoPageTransition` and `CupertinoFullscreenDialogTransition` (flutter/flutter#146999) 2024-05-06 [email protected] Roll Flutter Engine from 960a0c8fecbe to 463ff7d2d4d5 (1 revision) (flutter/flutter#147886) 2024-05-06 [email protected] Roll Flutter Engine from 70cc300f9ad8 to 960a0c8fecbe (1 revision) (flutter/flutter#147884) 2024-05-06 [email protected] [new gallery] Reisze gallery images (flutter/flutter#147882) 2024-05-06 [email protected] Roll Flutter Engine from d0f99b35eac6 to 70cc300f9ad8 (1 revision) (flutter/flutter#147880) 2024-05-06 [email protected] Fix leak in a test. (flutter/flutter#147846) 2024-05-06 [email protected] Roll Flutter Engine from a30ae7729c95 to d0f99b35eac6 (3 revisions) (flutter/flutter#147878) 2024-05-06 [email protected] Roll Packages from f4719ca to 2dfe645 (3 revisions) (flutter/flutter#147866) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/flutter@04424e1...7920a52 2024-05-07 [email protected] Add tests for callback_shortcuts.0.dart API example. (flutter/flutter#147536) 2024-05-07 [email protected] Improve Android SDK and NDK mistmatch warning message (flutter/flutter#147809) 2024-05-07 [email protected] Add tests for shortcuts.dart API examples. (flutter/flutter#147433) 2024-05-07 [email protected] Added missing tests for ButtonStyle example (flutter/flutter#147457) 2024-05-07 [email protected] Roll Flutter Engine from ece1d686e3ba to 150f694a7816 (1 revision) (flutter/flutter#147912) 2024-05-07 [email protected] DropdownMenu cleanup (flutter/flutter#147860) 2024-05-07 [email protected] Roll Flutter Engine from 80470584e1e1 to ece1d686e3ba (1 revision) (flutter/flutter#147910) 2024-05-07 [email protected] Roll Flutter Engine from b7bfd94af743 to 80470584e1e1 (1 revision) (flutter/flutter#147906) 2024-05-07 [email protected] Roll Flutter Engine from b64e2300bcd0 to b7bfd94af743 (1 revision) (flutter/flutter#147905) 2024-05-07 [email protected] fix MenuItemButton if child is null (flutter/flutter#147485) 2024-05-07 [email protected] Fix document generation, eliminate template support from snippets tool. (flutter/flutter#147893) 2024-05-07 [email protected] Roll Flutter Engine from 4cb9e02c06ce to b64e2300bcd0 (1 revision) (flutter/flutter#147904) 2024-05-07 [email protected] test focus example 0 (flutter/flutter#147564) 2024-05-07 [email protected] Roll Flutter Engine from 422f92b992c5 to 4cb9e02c06ce (1 revision) (flutter/flutter#147899) 2024-05-06 [email protected] Roll pub packages (flutter/flutter#147896) 2024-05-06 [email protected] Roll Flutter Engine from 463ff7d2d4d5 to 422f92b992c5 (5 revisions) (flutter/flutter#147895) 2024-05-06 [email protected] MultiSelectableSelectionContainerDelegate documentation fixes. (flutter/flutter#147843) 2024-05-06 [email protected] Roll pub packages (flutter/flutter#147891) 2024-05-06 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.4 to 4.1.5 (flutter/flutter#147888) 2024-05-06 [email protected] Fix janks and memory leaks in `CupertinoPageTransition` and `CupertinoFullscreenDialogTransition` (flutter/flutter#146999) 2024-05-06 [email protected] Roll Flutter Engine from 960a0c8fecbe to 463ff7d2d4d5 (1 revision) (flutter/flutter#147886) 2024-05-06 [email protected] Roll Flutter Engine from 70cc300f9ad8 to 960a0c8fecbe (1 revision) (flutter/flutter#147884) 2024-05-06 [email protected] [new gallery] Reisze gallery images (flutter/flutter#147882) 2024-05-06 [email protected] Roll Flutter Engine from d0f99b35eac6 to 70cc300f9ad8 (1 revision) (flutter/flutter#147880) 2024-05-06 [email protected] Fix leak in a test. (flutter/flutter#147846) 2024-05-06 [email protected] Roll Flutter Engine from a30ae7729c95 to d0f99b35eac6 (3 revisions) (flutter/flutter#147878) 2024-05-06 [email protected] Roll Packages from f4719ca to 2dfe645 (3 revisions) (flutter/flutter#147866) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Fix #147479
Pre-launch Checklist
If you need help, consider asking for advice on the #hackers-new channel on Discord.