Skip to content

Conversation

@maryx
Copy link
Contributor

@maryx maryx commented Jul 13, 2017

When creating a Slider widget, a user can now customize:

  • inactiveColor, the color of the not-yet-played portion of the slider (default to theme.unselectedWidgetColor)
  • showThumb, whether to show the circle thumb (default to true)

@Hixie
Copy link
Contributor

Hixie commented Jul 13, 2017

This will need tests; the test/rendering/mock_canvas.dart file has a paints matcher which may help.

@Hixie
Copy link
Contributor

Hixie commented Jul 17, 2017

What's the use case for not showing the thumb?

expect(sliderBox, paints..circle(color: theme.accentColor));
await tester.pumpWidget(buildApp(customColor));
expect(sliderBox, paints..rect(color: customColor)..rect(color: theme.unselectedWidgetColor));
expect(sliderBox, paints..circle(color: customColor));
Copy link
Contributor

Choose a reason for hiding this comment

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

you probably want some negative tests here too, verifying that there isn't a circle of the custom color when the custom color isn't set and that there isn't one of the accent color when the custom color is set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@maryx
Copy link
Contributor Author

maryx commented Jul 18, 2017

One of our use cases of the slider doesn't have the thumb. However, after some discussion, we are removing that use case, so I will remove the showThumb from this PR.

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

Ok!

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

LGTM

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

This can land once the tree is green.

@Hixie
Copy link
Contributor

Hixie commented Jul 19, 2017

Thank you very much for your contribution!

@sethladd
Copy link
Contributor

Thank you @maryx !

@maryx
Copy link
Contributor Author

maryx commented Jul 20, 2017

@Hixie Thanks very much! Can you merge this in please? I don't have write access.

@Hixie Hixie merged commit bb15e34 into flutter:master Jul 20, 2017
@Hixie
Copy link
Contributor

Hixie commented Jul 20, 2017

Done! Thanks again!

@maryx maryx deleted the add-slider-customizations branch July 20, 2017 18:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants