-
Notifications
You must be signed in to change notification settings - Fork 486
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 scrolling issues in CupertinoPicker
#3678
Conversation
Reviewer's Guide by SourceryThis pull request addresses the scrolling issues in File-Level Changes
Tips
|
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.
Hey @ndonkoHenri - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -63,14 +102,12 @@ class _CupertinoPickerControlState extends State<CupertinoPickerControl> { | |||
useMagnifier: useMagnifier, | |||
looping: looping, | |||
onSelectedItemChanged: (int index) { | |||
_index = index; |
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.
suggestion: Consider using setState
when updating _index
.
To ensure the UI updates correctly, consider wrapping the assignment of _index
in a setState
call.
_index = index; | |
setState(() { | |
_index = index; | |
}); |
Fixes #3649
Notes
CupertinoTimerPicker
was reported to have thesame issue, but it has noscrollController
, hence the SO solution can't be applicable.Test Code
https://flet.dev/docs/controls/cupertinopicker
Summary by Sourcery
This pull request addresses and fixes the scrolling issues in the
CupertinoPicker
component by introducing aFixedExtentScrollController
and adding logic to manage scroll events, ensuring correct item selection and smooth scrolling behavior.CupertinoPicker
by implementing aFixedExtentScrollController
and managing scroll events to ensure proper item selection.