Skip to content

Make sure that a DateRangePickerDialog doesn't crash in 0x0 environments #173754

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahmedsameha1
Copy link
Contributor

This is my attempt to handle #6537 for the DateRangePickerDialog 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 Aug 14, 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 DateRangePickerDialog does not crash when rendered in a zero-sized environment, addressing a reported issue. The test case is well-defined and covers the scenario. My review includes a couple of suggestions to improve the test's maintainability and clarity by adding a comment linking to the original issue and explicitly asserting that no exceptions are thrown, which are common practices in this test file.

@@ -1967,6 +1967,16 @@ void main() {
expect(getDayCount(secondMonthItem), 21);
});
});

testWidgets('DateRangePickerDialog 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.

medium

For better maintainability and to provide context for this test, it's a good practice to add a comment linking to the issue it's fixing. This is a common pattern in this test file.

  // Regression test for https://github.com/flutter/flutter/issues/6537
  testWidgets('DateRangePickerDialog renders at zero area', (WidgetTester tester) async {

Comment on lines +1978 to +1979
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To make the test's intent clearer and more robust, it's good practice to explicitly assert that no exception was thrown during widget rendering. This pattern is used in other tests in this file.

    );
    expect(tester.takeException(), isNull);
  });

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.

1 participant