textHeightBehavior static method

TextHeightBehavior? textHeightBehavior(
  1. DataSource source,
  2. List<Object> key
)

Returns a TextHeightBehavior from the specified map.

If the map is absent, returns null.

Otherwise (even if it has no keys), the TextHeightBehavior is created from the following keys: 'applyHeightToFirstAscent(boolean; defaults to true),applyHeightToLastDescent(boolean, defaults to true), andleadingDistribution` (enumValue of TextLeadingDistribution, deafults to TextLeadingDistribution.proportional).

Implementation

static TextHeightBehavior? textHeightBehavior(DataSource source, List<Object> key) {
  if (!source.isMap(key)) {
    return null;
  }
  return TextHeightBehavior(
    applyHeightToFirstAscent: source.v<bool>([...key, 'applyHeightToFirstAscent']) ?? true,
    applyHeightToLastDescent: source.v<bool>([...key, 'applyHeightToLastDescent']) ?? true,
    leadingDistribution: enumValue<TextLeadingDistribution>(TextLeadingDistribution.values, source, [...key, 'leadingDistribution']) ?? TextLeadingDistribution.proportional,
  );
}