scale method
Returns a scaled copy with all spatial fields and text size multiplied
by factor.
Scales: width, height, padding, margin, textStyle (font size + letter spacing), and the style textStyleResolver returns, by the same rule. A null from the resolver stays null, so the fallback is unchanged. Does NOT scale: tooltipTheme. Tooltips are classified as chrome and excluded from Scale — see ADR-0004.
defaultFontSize is used to resolve a null TextStyle.fontSize before
scaling — callers should pass Theme.of(context).textTheme.bodyMedium?.fontSize.
Identity: scale(1.0, defaultFontSize: …) returns this.
Implementation
FolderNodeTheme<T> scale(double factor, {required double defaultFontSize}) {
assert(factor > 0, 'scale factor must be > 0, got $factor');
if (factor == 1.0) return this;
return copyWith(
width: width * factor,
height: height * factor,
padding: padding * factor,
margin: margin * factor,
textStyle: scaleTextStyle(textStyle, factor, defaultFontSize),
textStyleResolver: textStyleResolver == null
? null
: (node) {
final style = textStyleResolver!(node);
return style == null
? null
: scaleTextStyle(style, factor, defaultFontSize);
},
// tooltipTheme intentionally not delegated — ADR-0004 (chrome).
);
}