jsonToTextStyle function

TextStyle? jsonToTextStyle(
  1. Map<String, dynamic> data
)

Implementation

TextStyle? jsonToTextStyle(Map<String, dynamic> data) {
  return TextStyle(
    color: data['color'] == null ? null : Color(asT<int>(data['color'])),
    decoration: data['decoration'] == null
        ? null
        : stringToTextDecoration(asT<String>(data['decoration'])),
    decorationColor: data['decorationColor'] == null
        ? null
        : Color(asT<int>(data['decorationColor'])),
    decorationStyle: ExEnum.tryParse<TextDecorationStyle>(
        TextDecorationStyle.values, asT<String>(data['decorationStyle'])),
    decorationThickness: data['decorationThickness'] == null
        ? null
        : asT<double>(data['decorationThickness']),
    fontWeight: ExEnum.tryParse<FontWeight>(
        FontWeight.values, asT<String>(data['fontWeight'])),
    fontStyle: ExEnum.tryParse<FontStyle>(
        FontStyle.values, asT<String>(data['fontStyle'])),
    fontFamily:
        data['fontFamily'] == null ? null : asT<String>(data['fontFamily']),
    fontFamilyFallback: data['fontFamilyFallback'] == null
        ? null
        : asT<String>(data['fontFamilyFallback']).split(','),
    fontSize: data['fontSize'] == null ? null : asT<double>(data['fontSize']),
    letterSpacing: data['letterSpacing'] == null
        ? null
        : asT<double>(data['letterSpacing']),
    wordSpacing:
        data['wordSpacing'] == null ? null : asT<double>(data['wordSpacing']),
    textBaseline:
        ExEnum.tryParse(TextBaseline.values, asT<String>(data['textBaseline'])),
    height: data['height'] == null ? null : asT<double>(data['height']),
    locale: data['locale'] == null ? null : jsonToLocale(asMap(data['locale'])),
  );
}