Skip to content
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: container calculation not applied due to outdated value #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rodolfo-arg
Copy link

@rodolfo-arg
Copy link
Author

rodolfo-arg commented Oct 17, 2024

Currently, when the screen is resizing, layout builder rebuilds the widget, and, _containerLeft, a value that's used to calculate the correct slider position, is expected to be updated with the new screen size, as well as its constraints (in case it is expanded). There's currently a condition to check that the value of _containerLeft does't go above the available space of the constraints, yet, for the condition, the OUTDATED value of _containerLeft before resizing is used to check if this is true, so if the screen is expanding, the condition is not met, as it shows there's not enough space to fill.
Now, after this fix, the correct updated value is set, which indicates there's actually enough space when using the current value and the slider no longer renders with wrong paint coordinates.

@rodolfo-arg
Copy link
Author

After testing in an app that requires 3 sliders across in a row, it was observed the sliders are still bugging. I can't wrap my head around why the condition was there in the first place as it is expecting the (screenWidth - constraintMaxWidth) always equal currentPosition relative to the screen, which is ONLY true when there's only 2 sliders max side by side occupying full available space and no widgets in between. To deal with this on my end, I just completely removed the condition and can't seem to observe any unexpected behaviour so far. This "fix" has been provided to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant