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

Range slider #1723

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Range slider #1723

wants to merge 13 commits into from

Conversation

rmahmadkhan
Copy link
Collaborator

@rmahmadkhan rmahmadkhan commented Nov 14, 2024

Ticket #1580

Example code

Slider:
  id: sliderOne
  label: Range Slider
  min: 0
  max: 10
  divisions: 10
  initialValue: 1 4
  isRange: true
  onChange: |
    sliderOne.value.text = "Slider is set to " + this.value;

@rmahmadkhan rmahmadkhan self-assigned this Nov 14, 2024
@rmahmadkhan
Copy link
Collaborator Author

There is an issue of theme with the slider labels which needs to be resolved before merging.

Screenshot 2024-11-14 at 5 11 28 PM

@rmahmadkhan
Copy link
Collaborator Author

I also see a PR #1725 related to more customizations in simple Silder widget. Since we would want the maximum similar customizations, should i wait for the that to merge and then use those here as well?

cc @kmahmood74 @TheNoumanDev

modules/ensemble/lib/util/utils.dart Outdated Show resolved Hide resolved
'initialValue': (value) =>
_controller.value = Utils.optionalDouble(value) ?? 0,
'initialValue': (value) => _controller.value =
Utils.getRangeValues(value) ?? const RangeValues(0, 0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getter implementation for RangeValues needs to expose the individual start and end values since returning only the RangeValues object doesn't allow direct access to these values.

Copy link
Collaborator Author

@rmahmadkhan rmahmadkhan Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally did not do that. Since we are using RangeValue for for both, a user can get start or end value through value.
A thing we can do instead is add another getter in value which returns single value if start === end.

}
}
: null,
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the duplicate code which can be converted to method and use them.

Copy link
Collaborator Author

@rmahmadkhan rmahmadkhan Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved whole onChanged function to a separate function

modules/ensemble/lib/widget/widget_registry.dart Outdated Show resolved Hide resolved
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.

2 participants