Skip to content

Overhauling Slider Widget #20026

Closed
Closed

Description

@escamoteur

Hi,

I wanted to use a Slider in my current project and stumbled upon several weaknesses in the current design:

  1. Material Slider track should be customizable. #19216 The current design that you have to use a SliderComponentShape if you want to customize the Thumb of a Slider is non intuitive and against the way Flutter typically builds its widgets. I would have expected to have the option to pass the size of the thumb and a builder function that gets the current slider value an returns a Widget that draws the Slider.
    In the current approach I'm suddenly confronted with painting on a Canvas. If you want to output a Text inside the Thumb you need a TextPainter too. Not easy for starters and not in the Flutter philosophie of composing widgets.

  2. Your SliderComponentShape gets the current Slider value as percentage and not the absolute value although you pass limits to the Slider constructor as absolute Values.

  3. If you set a minimum Value you suddenly get fractional value steps if you defined steps for the Slider.

  4. If you have a big range of values the linear curve of the slider isn't enough there should be an exponential curve too that allows small intervals for small values and then bigger steps.

  5. A way to pass unit Widgets that get displayed at the correct position below or above the Slider.

All of the above should also be supported by the coming RangeSlider.

Activity

  1. zoechi commented on Jul 31, 2018

    @zoechi
  2. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jul 31, 2018
  3. escamoteur commented on Jul 31, 2018

    @escamoteur
    ContributorAuthor

    Ah yes I haven't even thought of the customizing the Slider track, I think it makes sense to have all in here.

  4. slightfoot commented on Jul 31, 2018

    @slightfoot
    Member
  5. clocksmith commented on Feb 25, 2019

    @clocksmith
    Contributor

    4 and 5 should now be possible with the current API for the single slider

    For 1, the Slider does not contain any sub widgets because it contains a RenderBox. There are many good examples of painting with the default shapes. I will also be updating the gallery with even more examples.

    @escamoteur Can you confirm that the new shape painters can accomplish cases 4 and 5?

    2 is also by design of the shape painters

    For 3, I am not following 100%, but it seems like its working as intended by rendering tick marks after setting divisions. Is something else expected?

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 1, 2019
  7. no-response commented on May 14, 2019

    @no-response

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.

  8. github-actions commented on Aug 30, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packageswaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions