parseSnackBarTheme function

SnackBarThemeData? parseSnackBarTheme(
  1. ThemeData theme,
  2. Map<String, dynamic>? j
)

Implementation

SnackBarThemeData? parseSnackBarTheme(
    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.snackBarTheme.copyWith(
    backgroundColor: parseColor(theme, j["bgcolor"]),
    actionTextColor: parseColor(theme, j["action_text_color"]),
    actionBackgroundColor: parseColor(theme, j["action_bgcolor"]),
    closeIconColor: parseColor(theme, j["close_icon_color"]),
    disabledActionTextColor: parseColor(theme, j["disabled_action_text_color"]),
    disabledActionBackgroundColor:
        parseColor(theme, j["disabled_action_bgcolor"]),
    elevation: parseDouble(j["elevation"]),
    shape: j["shape"] != null ? outlinedBorderFromJSON(j["shape"]) : null,
    behavior: parseSnackBarBehavior(j["behavior"]),
    contentTextStyle: parseTextStyle("content_text_style"),
    width: parseDouble(j["width"]),
    insetPadding: edgeInsetsFromJson(j["inset_padding"]),
    dismissDirection: parseDismissDirection(j["dismiss_direction"]),
    showCloseIcon: parseBool(j["show_close_icon"]),
    actionOverflowThreshold: parseDouble(j["action_overflow_threshold"]),
  );
}