textStyle static method
Returns a TextStyle from the specified map.
If the map is absent, returns null.
Otherwise (even if it has no keys), the TextStyle is created from the
following keys: color
(color), backgroundColor
(color), fontSize
(double), fontWeight
(enumValue of FontWeight), fontStyle
(enumValue of FontStyle), letterSpacing
(double), wordSpacing
(double), textBaseline
(enumValue of TextBaseline), height
(double), leadingDistribution
(enumValue of
TextLeadingDistribution), locale
(locale), foreground
(paint),
background
(paint), shadows
(list of boxShadows), fontFeatures
(list of fontFeatures), decoration
(textDecoration),
decorationColor
(color), decorationStyle
(enumValue of
TextDecorationStyle), decorationThickness
(double), 'fontFamily(string),
fontFamilyFallback([list] of [string]), and
overflow`
(enumValue of TextOverflow).
Implementation
static TextStyle? textStyle(DataSource source, List<Object> key) {
if (!source.isMap(key)) {
return null;
}
return TextStyle(
color: color(source, [...key, 'color']),
backgroundColor: color(source, [...key, 'backgroundColor']),
fontSize: source.v<double>([...key, 'fontSize']),
fontWeight: enumValue<FontWeight>(FontWeight.values, source, [...key, 'fontWeight']),
fontStyle: enumValue<FontStyle>(FontStyle.values, source, [...key, 'fontStyle']),
letterSpacing: source.v<double>([...key, 'letterSpacing']),
wordSpacing: source.v<double>([...key, 'wordSpacing']),
textBaseline: enumValue<TextBaseline>(TextBaseline.values, source, ['textBaseline']),
height: source.v<double>([...key, 'height']),
leadingDistribution: enumValue<TextLeadingDistribution>(TextLeadingDistribution.values, source, [...key, 'leadingDistribution']),
locale: locale(source, [...key, 'locale']),
foreground: paint(source, [...key, 'foreground']),
background: paint(source, [...key, 'background']),
shadows: list<BoxShadow>(source, [...key, 'shadows'], boxShadow),
fontFeatures: list<FontFeature>(source, [...key, 'fontFeatures'], fontFeature),
decoration: textDecoration(source, [...key, 'decoration']),
decorationColor: color(source, [...key, 'decorationColor']),
decorationStyle: enumValue<TextDecorationStyle>(TextDecorationStyle.values, source, [...key, 'decorationStyle']),
decorationThickness: source.v<double>([...key, 'decorationThickness']),
fontFamily: source.v<String>([...key, 'fontFamily']),
fontFamilyFallback: list<String>(source, [...key, 'fontFamilyFallback'], string),
overflow: enumValue<TextOverflow>(TextOverflow.values, source, ['overflow']),
);
}