InheritedProperties.root constructor

InheritedProperties.root([
  1. Iterable deps = const [],
  2. TextStyle? widgetStyle
])

Creates the root properties set.

Implementation

factory InheritedProperties.root([
  Iterable<dynamic> deps = const [],
  TextStyle? widgetStyle,
]) {
  var style = _get<TextStyle>(deps) ?? const TextStyle();
  style = style.merge(widgetStyle);

  final tsf = _get<TextScaleFactor>(deps);
  final fontSize = style.fontSize;
  if (tsf != null && tsf.value != 1.0 && fontSize != null) {
    style = style.copyWith(
      debugLabel: 'fwfh: fontSize *= textScaleFactor',
      fontSize: fontSize * tsf.value,
    );
  }

  return InheritedProperties._(
    null,
    [
      ...deps,
      if (style.height != null) NormalLineHeight(style.height),
    ],
    style,
  );
}