fromJson static method

TooltipStep? fromJson(
  1. Map<String, dynamic> json
)

Implementation

static TooltipStep? fromJson(Map<String, dynamic> json) {
  final anchorKey = optString(json, 'anchorKey');
  if (anchorKey.isEmpty) return null;
  return TooltipStep(
    anchorKey: anchorKey,
    delayInMs: json.containsKey('delayInMs') ? optInt(json, 'delayInMs', 0) : null,
    title: optString(json, 'title'),
    body: optString(json, 'body'),
    placement: optString(json, 'placement', 'bottom'),
    backgroundColor:
        colorOr(optString(json, 'backgroundColor'), const Color(0xFFFFFFFF)),
    borderColor: colorOr(optString(json, 'borderColor'), const Color(0x00000000)),
    borderWidth: optDouble(json, 'borderWidth', 0),
    cornerRadius: optDouble(json, 'cornerRadius', 8),
    shadow: optBool(json, 'shadow', true),
    maxWidth: optDouble(json, 'maxWidth', 280),
    padding: optDouble(json, 'padding', 12),
    showArrow: optBool(json, 'showArrow', true),
    arrowColor: _color(json, 'arrowColor'),
    arrowBorderColor: _color(json, 'arrowBorderColor'),
    arrowSize: optDouble(json, 'arrowSize', 8),
    titleColor: colorOr(optString(json, 'titleColor'), const Color(0xFF111111)),
    titleSize: optDouble(json, 'titleSize', 15),
    titleWeight: _weight(optString(json, 'titleWeight', '700')),
    bodyColor: colorOr(optString(json, 'bodyColor'), const Color(0xFF444444)),
    bodySize: optDouble(json, 'bodySize', 13),
    buttonPrimaryBackgroundColor: colorOr(
        optString(json, 'buttonPrimaryBackgroundColor'), const Color(0xFF2563EB)),
    buttonPrimaryTextColor: colorOr(
        optString(json, 'buttonPrimaryTextColor'), const Color(0xFFFFFFFF)),
    buttonGhostTextColor: colorOr(
        optString(json, 'buttonGhostTextColor'), const Color(0xFF2563EB)),
    actions: _actions(json),
  );
}