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 slider calculation for evenly divisible values #18

Merged
merged 1 commit into from Jun 20, 2020

Conversation

StefanSlehta
Copy link
Contributor

When using the slider, I noticed a bug where for evenly divisible values, the slider doesn't step correctly.

Example, for

  SliderSettingsTile(
              settingKey: 'my-key',
              title: 'Slider demo',
              defaultValue: 100.0,
              minValue: 0.0,
              maxValue: 100.0,
              step: 10.0,
            ),

I get the following result
Screen Recording 2020-06-19 at 6 13 09 PM

Likely because 100 / 10 + 1 = 11, so the step becomes 100 / 11 = 9.090909...

After the fix, for the same code
Screen Recording 2020-06-19 at 6 14 27 PM

Sorry for the super slow gif, conversion from mov wasn't the best.

@barnabasbartha barnabasbartha merged commit 06c0a4a into barnabasbartha:master Jun 20, 2020
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.

None yet

2 participants