parseChipTheme function

ChipThemeData? parseChipTheme(
  1. ThemeData theme,
  2. Map<String, dynamic>? j
)

Implementation

ChipThemeData? parseChipTheme(ThemeData theme, Map<String, dynamic>? j) {
  if (j == null) {
    return null;
  }
  TextStyle? parseTextStyle(String propName) {
    return j[propName] != null ? textStyleFromJson(theme, j[propName]) : null;
  }

  return theme.chipTheme.copyWith(
    color: getWidgetStateProperty<Color?>(
        j["color"], (jv) => parseColor(theme, jv as String)),
    backgroundColor: parseColor(theme, j["bgcolor"]),
    shadowColor: parseColor(theme, j["shadow_color"]),
    surfaceTintColor: parseColor(theme, j["surface_tint_color"]),
    elevation: parseDouble(j["elevation"]),
    shape: j["shape"] != null ? outlinedBorderFromJSON(j["shape"]) : null,
    padding: edgeInsetsFromJson(j["padding"]),
    labelPadding: edgeInsetsFromJson(j["label_padding"]),
    labelStyle: parseTextStyle("label_text_style"),
    secondaryLabelStyle: parseTextStyle("secondary_label_text_style"),
    disabledColor: parseColor(theme, j["disabled_color"]),
    selectedColor: parseColor(theme, j["selected_color"]),
    checkmarkColor: parseColor(theme, j["check_color"]),
    deleteIconColor: parseColor(theme, j["delete_icon_color"]),
    side: j["border_side"] != null
        ? borderSideFromJSON(theme, j["border_side"], null)
        : null,
    secondarySelectedColor: parseColor(theme, j["secondary_selected_color"]),
    brightness: j["brightness"] != null
        ? Brightness.values.firstWhereOrNull(
            (b) => b.name.toLowerCase() == j["brightness"].toLowerCase())
        : null,
    selectedShadowColor: parseColor(theme, j["selected_shadow_color"]),
    showCheckmark: parseBool(j["show_checkmark"]),
    pressElevation: parseDouble(j["click_elevation"]),
    avatarBoxConstraints: boxConstraintsFromJSON(j["avatar_constraints"]),
    deleteIconBoxConstraints:
        boxConstraintsFromJSON(j["delete_icon_size_constraints"]),
  );
}