-
Notifications
You must be signed in to change notification settings - Fork 279
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 #165: add Key parameter to makePicker
#166
fix #165: add Key parameter to makePicker
#166
Conversation
@@ -215,7 +215,8 @@ class Picker { | |||
actions.add(TextButton( | |||
style: _getButtonStyle(ButtonTheme.of(context)), | |||
onPressed: () async { | |||
if (onConfirmBefore != null && !(await onConfirmBefore!(this, selecteds))) { | |||
if (onConfirmBefore != null && | |||
!(await onConfirmBefore!(this, selecteds))) { |
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.
Just dart formatter's fix.
daySuffix, | ||
hourSuffix, | ||
minuteSuffix, | ||
secondSuffix; |
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.
Just dart formatter's fix.
@@ -1215,7 +1221,7 @@ class DateTimePickerAdapter extends PickerAdapter<DateTime> { | |||
if (!_needUpdatePrev) { | |||
// check am/pm before hour-ap | |||
var ap = _columnType.indexWhere((element) => element == 6); | |||
if (ap > _columnType.indexWhere((element) => element == 7)) { | |||
if (ap > _columnType.indexWhere((element) => element == 7)) { |
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.
Just dart formatter's fix.
@@ -1432,7 +1438,8 @@ class DateTimePickerAdapter extends PickerAdapter<DateTime> { | |||
if (minuteInterval == null || minuteInterval! < 2) | |||
_text = "${intToStr(index)}${_checkStr(minuteSuffix)}"; | |||
else | |||
_text = "${intToStr(index * minuteInterval!)}${_checkStr(minuteSuffix)}"; | |||
_text = | |||
"${intToStr(index * minuteInterval!)}${_checkStr(minuteSuffix)}"; |
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.
Just dart formatter's fix.
Thanks! |
This will fix #165.
I added
key
parameter tomakePicker
method. If I pass consistent key to makePicker, the picker's dragging behavior is not interrupted (this is my expected behavior.)If I call
makePicker
onbuild
method, every build use different key ('ValueKey(this)') forPickerWidget
and this interrupt dragging (scrolling). With this PR, we can assign key forPickerWidget
explicitly or we can omit key for using conventional key ('ValueKey(this)').👇 is sample code to use this parameter.
If #165 is not correct usage, please close this PR 😢 Thank you ❤️