Skip to content

Conversation

@Piinks
Copy link
Contributor

@Piinks Piinks commented Jan 26, 2022

Last of several scrollbar clean up PRs to prepare for desktop scrollbars.
Original PR was #96935, but it was becoming too large
Fixes #96936

This PR adds track features as part of the RawScrollbar base class. This will make it easier for subclasses to have a track. It also ensures that if a track is visible, the scrollbar thumb is visible too.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@Piinks Piinks added c: new feature Nothing broken; request for a new capability c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. c: tech-debt Technical debt, code quality, testing, etc. labels Jan 26, 2022
@flutter-dashboard flutter-dashboard bot added the f: material design flutter/packages/flutter/material repository. label Jan 26, 2022
@Piinks Piinks mentioned this pull request Jan 26, 2022
5 tasks
@Piinks Piinks requested a review from xu-baolin January 26, 2022 23:43
'isAlwaysShown is deprecated.'
),
assert(
!((thumbVisibility == false || isAlwaysShown == false) && trackVisibility == true),
Copy link
Member

Choose a reason for hiding this comment

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

The assertion is a bit unfriendly. In this case, don't draw the track and documentation of this behavior. What do you think?
At the same time, the Scrollbar widget does not assert this, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The scrollbar widget does not assert this, but the _MaterialScrollbar and CupertinoScrollbar pass these values to the super class RawScrollbar, so they still get the assertion.
Here, where the user explicitly says 'show me the track, don't show me the thumb' I think it is reasonable to assert.

When ScrollbarThemeData.trackVisibility (MaterialStateProperty) is used, and the value changes based on different state combinations, it does not assert and just assumes that if the thumb is not visible then the track should not be.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense, thanks for explaining.

Copy link
Member

@xu-baolin xu-baolin left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. c: new feature Nothing broken; request for a new capability c: tech-debt Technical debt, code quality, testing, etc. f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up Scrollbar API

3 participants