Skip to content

Conversation

@hasnentai
Copy link
Contributor

@hasnentai hasnentai commented Jan 25, 2023

Exposed a callback when the user switches between entry mode from calendar to input, this way we can store the preferred input method in the application state and open the next date picker with the preferred entry mode already set (using the existing initialEntryMode parameter).

Fixes #113423

Example of callback onDatePickerModeChange

showDatePicker(
  context: context,
  initialDate: DateTime.now(),
  firstDate: DateTime.now(),
  lastDate: DateTime.now(),
  initialEntryMode: datePickerMode,
  onDatePickerModeChange: (mode) {
  setState(() {
    datePickerMode = mode;
  });
  },
)

Screen Recording

Screen.Recording.2023-01-25.at.11.53.51.AM.mov

CC: @Piinks , @HansMuller

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jan 25, 2023
@hasnentai hasnentai changed the title [WIP] : showDatePicker - Exposed callback when user changes entry mode (Calendar <=> Input ) Feat: showDatePicker - Exposed callback when user changes entry mode (Calendar <=> Input ) Jan 25, 2023
@hasnentai hasnentai changed the title Feat: showDatePicker - Exposed callback when user changes entry mode (Calendar <=> Input ) Feat: showDatePicker - Exposed callback when user changes entry mode (Calendar <=> Input ) Jan 25, 2023
@hasnentai hasnentai changed the title Feat: showDatePicker - Exposed callback when user changes entry mode (Calendar <=> Input ) Feat: showDatePicker - Exposed callback when user changes Date Picker Mode (Calendar <=> Input ) Jan 25, 2023
@hasnentai hasnentai changed the title Feat: showDatePicker - Exposed callback when user changes Date Picker Mode (Calendar <=> Input ) Feat: showDatePicker - Exposed callback when user changes Date Picker Mode Jan 25, 2023
@HansMuller HansMuller self-requested a review January 27, 2023 19:17
@HansMuller HansMuller force-pushed the feat-datepicker-onchange branch from 9a43820 to a6b11da Compare March 2, 2023 00:23
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

This looks great, just noted some small stuff.

@hasnentai hasnentai requested a review from HansMuller March 2, 2023 11:00
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

Still really close. The presubmit analyze test is complaining about some trailing spaces.

@hasnentai hasnentai requested a review from HansMuller March 3, 2023 06:19
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@HansMuller HansMuller merged commit 859b6ec into flutter:master Mar 3, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
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.

showDatePicker - expose callback or change notifier when user changes entry mode (calendar / input)

2 participants