Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Jan 13, 2022

Allow themes to override Slider's mouse cursor.

Partial fix to #88371

This PR is based on #88425 (author: @jpnurmi). It's been extended a little per the review feedback for the PR. PR #88371 wasn't reviewed for months by yours truly, so I'm completing the project here.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jan 13, 2022
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

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

LGTM. Nice.

Comment on lines -543 to -544
assert(widget.onChangeStart != null);
widget.onChangeStart!(_lerp(value));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know the history of this assert? Is it here just to protect the reference in the call below? If so, yeah it would be good to remove it as you have. But was it actually a requirement of the widget to not have this null (which seems odd)? If so it should be moved to the widget constructor, no? Same for the similar assert in _handleDragEnd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was just to defend against an error being introduced in the original code on lines 751,752. No longer needed.

Comment on lines +706 to +711
final Set<MaterialState> states = <MaterialState>{
if (!_enabled) MaterialState.disabled,
if (_hovering) MaterialState.hovered,
if (_focused) MaterialState.focused,
if (_dragging) MaterialState.dragged,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice set up here. I like this pattern.

Comment on lines -751 to -752
onChangeStart: widget.onChangeStart != null ? _handleDragStart : null,
onChangeEnd: widget.onChangeEnd != null ? _handleDragEnd : null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, that seemed like a convoluted way to hook up the callback. Nice cleanup.

@HansMuller HansMuller merged commit c24b2c3 into flutter:master Jan 14, 2022
@HansMuller HansMuller deleted the slider_theme__mouse_cursor_v2 branch January 14, 2022 01:08
@jpnurmi jpnurmi mentioned this pull request Jan 16, 2022
8 tasks
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jan 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jan 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jan 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 4, 2022
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

2 participants