sceneTextStyleFor function

TextStyle sceneTextStyleFor(
  1. TextNode t
)

A text node's resolved properties as Flutter draws them. The animatable ones are read composed — what a motion track put there this frame — and the rest straight off the node.

A null TextNode.fontFamily is left null on purpose: the span merges with whatever DefaultTextStyle the app wraps the canvas in, so a scene that names no typeface inherits the app's rather than a guess.

Implementation

TextStyle sceneTextStyleFor(TextNode t) => TextStyle(
  fontFamily: t.fontFamily,
  fontSize: t.fxRendered('fontSize') as double,
  fontWeight: t.weight.flutter,
  fontStyle: t.italic ? FontStyle.italic : FontStyle.normal,
  letterSpacing: t.fxRendered('letterSpacing') as double,
  wordSpacing: t.fxRendered('wordSpacing') as double,
  height: t.fxRendered('lineHeight') as double,
  color: (t.fxRendered('color') as SceneColor).flutter,
  decoration: t.decoration.flutter,
  // Null is Flutter's own "the text's colour", which is what a design tool
  // means by leaving it unset.
  decorationColor: t.decorationColor?.flutter,
  decorationThickness: t.fxRendered('decorationThickness') as double,
  decorationStyle: t.decorationStyle.flutter,
  fontVariations: sceneFontVariations(t),
);