Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

This is my attempt to handle #6537 for the DrawerButton UI control.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jul 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a regression test to ensure that a DrawerButton does not crash when rendered in a zero-sized environment, which is a good step towards resolving the linked issue. However, the implementation of the fix itself appears to be missing from this pull request. Additionally, the new test for DrawerButton is located in back_button_test.dart, which is not the most logical place for it. For better test organization, it should be moved to a more relevant file.

Comment on lines 340 to 350
testWidgets('DrawerButton renders at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Center(
child: SizedBox.shrink(child: Scaffold(body: DrawerButton())),
),
),
);
final Finder drawerButtonIcon = find.byType(DrawerButtonIcon);
expect(tester.getSize(drawerButtonIcon).isEmpty, isTrue);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test for DrawerButton seems to be in an unrelated file (back_button_test.dart). According to the style guide, code should be ordered logically.1 This principle extends to test files, where related tests should be grouped together for better organization and maintainability. BackButton and DrawerButton serve different purposes.

Please consider moving this test to a more relevant file, such as a new drawer_button_test.dart or an existing test file for AppBar or Scaffold if one is more suitable.

Style Guide References

Footnotes

  1. The style guide states that class members should be ordered logically. This principle of logical grouping should also apply to tests within test files to improve maintainability. (link)

Copy link
Contributor

@dkwingsmt dkwingsmt Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think gemini makes good sense :) Probably move the test to drawer_button_test.dart?

@dkwingsmt
Copy link
Contributor

Hi @ahmedsameha1, can you address the comment above by moving the test case to material/drawer_button_test.dart? (The current file would have been ok if there were not a file for drawerButton already.)

@ahmedsameha1 ahmedsameha1 force-pushed the handle#6537-DraswerButton branch from 0e1eb09 to 47c6f01 Compare August 21, 2025 09:51
Copy link
Contributor

@dkwingsmt dkwingsmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist:

  • The test is in the correct file
  • The test name goes “does not crash at zero area”
  • The target widget is wrapped by Center (or is fullscreen)
  • The target widget does not have an overlay, or the overlay is tested
  • The target widget is expected to have a size of exactly Size.zero

expect(customCallbackWasCalled, true);
});

testWidgets('DrawerButton renders at zero area', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
testWidgets('DrawerButton renders at zero area', (WidgetTester tester) async {
testWidgets('DrawerButton does not crash at zero area', (WidgetTester tester) async {

),
);
final Finder drawerButtonIcon = find.byType(DrawerButtonIcon);
expect(tester.getSize(drawerButtonIcon).isEmpty, isTrue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(tester.getSize(drawerButtonIcon).isEmpty, isTrue);
expect(tester.getSize(find.byType(DrawerButtonIcon)), Size.zero);

Copy link
Contributor

@dkwingsmt dkwingsmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well!

@MitchellGoodwin MitchellGoodwin added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 1, 2025

autosubmit label was removed for flutter/flutter/172948, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2025
@MitchellGoodwin MitchellGoodwin force-pushed the handle#6537-DraswerButton branch from 1f246c0 to 52807dd Compare October 1, 2025 17:34
@MitchellGoodwin MitchellGoodwin added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Oct 1, 2025
Merged via the queue into flutter:master with commit 4f49888 Oct 1, 2025
76 of 77 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Oct 2, 2025
flutter/flutter@7811e89...65aca36

2025-10-02 [email protected] Roll Skia from 257c1f94afaa to 05c1f5803415 (4 revisions) (flutter/flutter#176402)
2025-10-02 [email protected] [ Widget Preview ] Fix resolution for workspace "hosted" dependencies (flutter/flutter#176358)
2025-10-02 [email protected] Roll Skia from b5d8ae8d3410 to 257c1f94afaa (6 revisions) (flutter/flutter#176389)
2025-10-02 [email protected] Delete Skia-specific performance overlay implementation (flutter/flutter#176364)
2025-10-02 [email protected] Roll Fuchsia Linux SDK from 1Ai6VL4vb_GdGnWhg... to Vnoygds8HtDUvGLCK... (flutter/flutter#176381)
2025-10-01 [email protected] [ Widget Preview ] Persist "Filter by Selected File" toggle (flutter/flutter#176289)
2025-10-01 [email protected] Roll Skia from c44a36470d07 to b5d8ae8d3410 (5 revisions) (flutter/flutter#176367)
2025-10-01 [email protected] Reapply "Update the AccessibilityPlugin::Announce method to account f… (flutter/flutter#176107)
2025-10-01 [email protected] Roll Dart SDK from 8ffec1435cf3 to 4f90a06328cb (3 revisions) (flutter/flutter#176369)
2025-10-01 [email protected] [ Tool / l10n ] Fix issue where localization generator assumed current directory was the target project (flutter/flutter#175881)
2025-10-01 [email protected] Make sure that a DateRangePickerDialog doesn't crash in 0x0 environments (flutter/flutter#173754)
2025-10-01 [email protected] Make sure that a DrawerButton doesn't crash in 0x0 environment (flutter/flutter#172948)

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] 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
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Oct 7, 2025
…er#172948)

This is my attempt to handle
flutter#6537 for the DrawerButton UI
control.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…er#172948)

This is my attempt to handle
flutter#6537 for the DrawerButton UI
control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants