-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix default value for DateRangePickerDialog currentDate #177448
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
Fix default value for DateRangePickerDialog currentDate #177448
Conversation
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.
Code Review
This pull request addresses a crash in DateRangePickerDialog that occurred when the currentDate parameter was omitted. The issue was caused by a null-check operator on a potentially null value. The fix correctly provides a default value for currentDate by using a getter that falls back to calendarDelegate.now(). The implementation is clean and effective. A new regression test has also been added to verify the fix and prevent this issue from recurring. The code changes look good and I have no further comments.
justinmc
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 👍
|
autosubmit label was removed for flutter/flutter/177448, 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. |
092d83d to
34850e8
Compare
## Description This PR fixes the default value for `DateRangePickerDialog.currentDate`. Before this PR, the comment mentions that `currentDate` defaults to `DateTime.now()` but this is not the case (the value is not initialised). After this PR, `currentDate` defaults to `calendarDelegate.now()`. ## Related Issue Fixes [DateRangePickerDialog crashes when currentDate is omitted](flutter#177441) ## Tests - Adds 1 test
Description
This PR fixes the default value for
DateRangePickerDialog.currentDate.Before this PR, the comment mentions that
currentDatedefaults toDateTime.now()but this is not the case (the value is not initialised).After this PR,
currentDatedefaults tocalendarDelegate.now().Related Issue
Fixes DateRangePickerDialog crashes when currentDate is omitted
Tests