Slider relies on brittle paint order to work properly #98770
Labels
f: material design
flutter/packages/flutter/material repository.
framework
flutter/packages/flutter repository. See also f: labels.
team-design
Owned by Design Languages team
triaged-design
Triaged by Design Languages team
The material Slider widget relies on the order in which nodes get precessed during PAINT in order to present itself visually correctly. That's brittle.
Here's the problem: In its paint method
_RenderSlider
configures thepaintValueIndicator
painter...flutter/packages/flutter/lib/src/material/slider.dart
Line 1453 in 5684b9f
... which is used in the paint method of
_RenderValueIndicator
:flutter/packages/flutter/lib/src/material/slider.dart
Line 1611 in 5684b9f
This only works if
_RenderSlider
is processed before_RenderValueIndicator
during PAINT. Otherwise,_RenderValueIndicator.paint
will not see the painter configured by_RenderSlider.paint
and instead paint with an outdated painter.Since nodes are processed from deepest to shallowest, this works fine when
_RenderSlider
is deeper in the tree than_RenderValueIndicator
and breaks otherwise. It will also break when the order in which we process nodes during PAINT is flipped around as we did in #98219, which may give us some performance benefits. That PR saw breakages in google3 because of the problem described here (see b/219153804).Long story short: Slider should not relay on the somewhat brittle order in which nodes get processed during PAINT.
Side node: We should also add a test for this to the framework since this was only caught during a google3 roll.Done: #98772The text was updated successfully, but these errors were encountered: