Skip to content

Conversation

@xu-baolin
Copy link
Member

@xu-baolin xu-baolin commented Aug 25, 2020

Description

  1. The Slider paint incorrectly when the track shape is rectangular, it has a wrong offset.
  2. There have a gap between the active track and inactive track, If you increase the height, you can clearly see the gap.
    image

This gap was added intended, see #31564, but this process is different from RoundedRectSliderTrackShape, so I think we should remove it.

Related Issues

Fixes #64696

Tests

I added the following tests:

See files.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Aug 25, 2020
theme: ThemeData(
sliderTheme: const SliderThemeData(
trackShape: RectangularSliderTrackShape(),
)),
Copy link
Member Author

Choose a reason for hiding this comment

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

the second ) should at a new line

@xu-baolin
Copy link
Member Author

@HansMuller Hi, please review this change at your convenience, thanks very much!

@xu-baolin
Copy link
Member Author

The RangeSlider also have a gap when the track shape is Rectangular, I fixed at #64627

@HansMuller
Copy link
Contributor

CC @clocksmith @JoseAlba

Copy link
Contributor

@JoseAlba JoseAlba left a comment

Choose a reason for hiding this comment

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

██╗      ██████╗ ████████╗███╗   ███╗
██║     ██╔════╝ ╚══██╔══╝████╗ ████║
██║     ██║  ███╗   ██║   ██╔████╔██║
██║     ██║   ██║   ██║   ██║╚██╔╝██║
███████╗╚██████╔╝   ██║   ██║ ╚═╝ ██║
╚══════╝ ╚═════╝    ╚═╝   ╚═╝     ╚═╝

]);
});

testWidgets('Slider paint correctly when the track shape is rectangular', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

replace with: Slider track paints correctly when the shape is rectangular

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

theme: ThemeData(
sliderTheme: const SliderThemeData(
trackShape: RectangularSliderTrackShape(),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

trailing comma here

final Size thumbSize = sliderTheme.thumbShape.getPreferredSize(isEnabled, isDiscrete);

final Rect leftTrackSegment = Rect.fromLTRB(trackRect.left + trackRect.height / 2, trackRect.top, thumbCenter.dx - thumbSize.width / 2, trackRect.bottom);
final Rect leftTrackSegment = Rect.fromLTRB(trackRect.left, trackRect.top, thumbCenter.dx, trackRect.bottom);
Copy link
Contributor

Choose a reason for hiding this comment

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

NICE. This is all much more obvious.

@fluttergithubbot fluttergithubbot merged commit c26c236 into flutter:master Aug 28, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider paint incorrectly when the track shape is rectangular

6 participants