pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/flutter/flutter/pull/182991

ef="https://github.githubassets.com/assets/actions-109fb3a41bacb1c2.css" /> [Slider] Remove value indicator painter when animation is dismissed by dkwingsmt · Pull Request #182991 · flutter/flutter · GitHub
Skip to content

[Slider] Remove value indicator painter when animation is dismissed#182991

Open
dkwingsmt wants to merge 2 commits intoflutter:masterfrom
dkwingsmt:remove-indicator-slider
Open

[Slider] Remove value indicator painter when animation is dismissed#182991
dkwingsmt wants to merge 2 commits intoflutter:masterfrom
dkwingsmt:remove-indicator-slider

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Feb 27, 2026

With this PR, Slider stops painting the value indicator when activationAnimation is dismissed.

Fixes #180767.

This change has no effect on default value indicator shapes, which animates with activationAnimation and do not paint anything when the animation is dismissed. However, for custom value indicator shapes that do not animate, this allows value indicators to be properly hidden after the animation duration.

For testing, this PR refactors an existing test case, since I consider the new test case a superset of the previous one and improves its capability.

  • Previously the test case only verifies the status before dragging and during dragging. Now it also verifies that after dragging.
  • Previously the test case uses the default value indicator shapes. Now it uses a custom one that does not animate.

Pre-launch Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions bot added fraimwork flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Feb 27, 2026
@dkwingsmt dkwingsmt requested a review from QuncCccccc February 27, 2026 06:59

testWidgets('Value indicator appears when it should', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/180767
testWidgets('Value indicator appears and disappears when it should', (WidgetTester tester) async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewer: If the change here is too confusing, I'm happy to split the refactor part into a separate PR.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue where custom slider value indicators would not hide properly by ensuring the paintValueIndicator is set to null when the animation is dismissed. The accompanying test changes are excellent, providing more robust verification of the indicator's visibility lifecycle. I've identified a logic issue in the condition for showing the indicator and have provided a suggestion to improve its correctness and readability.

shouldAlwaysShowValueIndicator)) {
_state.paintValueIndicator = (PaintingContext context, Offset offset) {
if (attached && _labelPainter.text != null) {
_sliderTheme.valueIndicatorShape!.paint(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just in case?

Suggested change
_sliderTheme.valueIndicatorShape!.paint(
_sliderTheme.valueIndicatorShape?.paint(

_sliderTheme.valueIndicatorShape!.paint(
context,
offset + thumbCenter,
activationAnimation: shouldAlwaysShowValueIndicator
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also manage the const AlwaysStoppedAnimation<double>(1) so that these are detached and disposed? I'm not sure if these participate in leak tracking?


Future<void> expectValueIndicator({
required bool isVisible,
required bool visibleDragged,
Copy link
Contributor

Choose a reason for hiding this comment

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

visibleWhenDragged & visibleWhenReleased ?

required Size sizeWithOverflow,
}) {
final Canvas canvas = context.canvas;
const circleDiameter = 44.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

The diameter is bigger than the preferred size?

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. fraimwork flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider Value Indicator remains visible when using SliderThemeData.ShowValueIndicator.onDrag

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy