-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
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 the paintValueIndicator painter...
| _state.paintValueIndicator = (PaintingContext context, Offset offset) { |
... which is used in the paint method of _RenderValueIndicator:
| _state.paintValueIndicator?.call(context, offset); |
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: #98772