Apply segment label colour changes to the painted text
A colour-only style change (selected, unselected or disabled) only scheduled a repaint, but the text painter takes its style during layout, so the label kept its old colour until something else caused a layout. Request layout for every style change.
This commit is contained in:
1 parent
6daa85edae
commit
b276b9daf3
2 files changed
+28
-3
No files matched your search
@@ -893,12 +893,15 @@ class _RenderSegmentLabel extends RenderBox {
|
||||
TextStyle _style;
|
||||
set style(TextStyle value) {
|
||||
if (value == _style) return;
|
||||
final relayout =
|
||||
value.compareTo(_style).index > RenderComparison.paint.index;
|
||||
_style = value;
|
||||
relayout ? markNeedsLayout() : markNeedsPaint();
|
||||
// Layout even for a colour-only change: the painter takes the new style
|
||||
// (the selected or disabled colour) in _fit, not in paint.
|
||||
markNeedsLayout();
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
Color? get debugPaintedColor => _painter.text?.style?.color;
|
||||
|
||||
TextScaler _textScaler;
|
||||
set textScaler(TextScaler value) {
|
||||
if (value == _textScaler) return;
|
||||
|
||||
Reference in new issue
Block a user