Closed CorvusYe closed 2 months ago
I'm not sure if I like the design of this. Instead, we should provide the developer an option to open the picker programmatically - using keys, maybe? What do you think?
Thank you for your reply.
I have some questions that I would like to discuss with you. Does 'using keys' mean the following:
GlobalKey key = GlobalKey();
DatePicker(
key: key,
selected: v,
);
(key.currentState as dynamic).open();
If so, this calling method can indeed achieve the desired effect, but it seems more cumbersome. More encapsulation is needed to achieve parameter level logic control.
Moreover, _DatePickerState
is private and can only be cast through "as dynamic" when we call the open method externally, it seems a bit strange.
I am not sure if my understanding is in line with popular thinking.
autoOpen
can lead to unexpected behavior by the user. If the widget is ever entirely rebuilt, the panel would open as well. I prefer to leave this kind of control to the developer.
Moreover, _DatePickerState is private and can only be cast through "as dynamic" when we call the open method externally, it seems a bit strange.
Ideally, we'd make the necessary changes to make the picker states public.
autoOpen
can lead to unexpected behavior by the user. If the widget is ever entirely rebuilt, the panel would open as well. I prefer to leave this kind of control to the developer.
You' re right. I overlooked this point.
From this point of view, it would indeed be better for users to decide for themselves.
In some scenarios, we hope that time related forms will automatically pop up a panel when loaded to save the need for clicking again.
This PR affects
DatePicker
,TimePicker
, andPicker
Pre-launch Checklist
CHANGELOG.md
with my changes