iamvivekkaushik / DatePickerTimelineFlutter

Flutter Date Picker Library that provides a calendar as a horizontal timeline
Apache License 2.0
282 stars 198 forks source link

Enable external widgets to set DatePicker state #44

Open hegman12 opened 3 years ago

hegman12 commented 3 years ago

This PR adds 2 methods to controller - getCurrentDate and SetCurrentDate. These allow external widgets to set state of DatePicker. But more proper solution is to implement standard state management.

Description - There are 2 major ways to interact with DatePicker (or any widget).

  1. Allow DatePicker to send out updates when internal state changes. Currently this is done through ondateChnage hook.
  2. Allow DatePicker to update its state when external widgets request it. This PR adds 2 methods getCurrentDate and SetCurrentDate which allow to do that. This is like a easier workaround solution.
pealthoff commented 3 years ago

I needed the same thing and implemented a similar one but only with the set Date: https://github.com/iamvivekkaushik/DatePickerTimelineFlutter/pull/47

@hegman12 I don't think that what you did is a workaround, but the correct solution since it's good to have a way for the user to determine how he wants to control the date.

I only think that update the dependencies to nullsafety should be a totally different commit.