getFallBackConfig function

Map<String, dynamic> getFallBackConfig(
  1. String usecase
)

Returns a design-token compatible configuration map for a given use case. Returns an empty map {} when the use case is unknown.

Implementation

Map<String, dynamic> getFallBackConfig(String usecase) {
  final lower = usecase.toLowerCase();

  switch (lower) {
    case 'blue':
      return {
        "name": "blue-light",
        "description": "Blue theme fallback - light mode",
        "schema": "https://tr.designtokens.org/format/2025.10/schema.json",
        "color": {
          "primary": {"value": "#0062e1", "description": "Main brand hue"},
          "secondary": {"value": "#0051ff"},
          "accent": {"value": "#0062e1"},
          "brand-custom-1": {
            "value": "#0000d0",
            "description": "Custom brand slot"
          },
          "success": {"value": "#00a651"},
          "error": {"value": "#c00000"},
          "warning": {"value": "#ff8000"},
          "neutral": {"value": "#d0d0d7"},
          "surface": {"value": "#fefefe"},
          "background": {"value": "#ffffff"},
          "on-primary": {"value": "#ffffff"},
          "on-secondary": {"value": "#ffffff"},
          "on-success": {"value": "#ffffff"},
          "on-error": {"value": "#ffffff"},
          "on-background": {"value": "#02070d"},
          "primary-emphasized": {"value": "#0033aa"},
          "primary-deemphasized": {"value": "#97c0f0"},
          "neutral-emphasized": {"value": "#02070d"},
          "neutral-deemphasized": {"value": "#a0a0a7"},
          "type": "color"
        },
        "semantic": {
          "primary": {"value": "{color.primary}"},
          "surface": {"value": "{color.surface}"},
          "background": {"value": "{color.background}"},
          "on-primary": {"value": "{color.on-primary}"},
          "accent": {"value": "{color.accent}"},
          "error": {"value": "{color.error}"},
          "success": {"value": "{color.success}"},
          "warning": {"value": "{color.warning}"}
        },
        "component": {
          "header": {
            "useGradient": {"value": true, "type": "boolean"},
            "gradient": {
              "value": [
                {
                  "color": {"value": "{color.primary}"},
                  "position": 0
                },
                {
                  "color": {"value": "{color.primary-emphasized}"},
                  "position": 1
                }
              ]
            },
            "background": {"value": "{semantic.surface}"}
          }
        },
        "dimension": {
          "elevation": {
            "sm": {
              "value": {"value": 4, "unit": "px"}
            },
            "md": {
              "value": {"value": 8, "unit": "px"}
            }
          },
          "radius": {
            "md": {
              "value": {"value": 12, "unit": "px"}
            }
          }
        }
      };

    case 'red':
      return {
        "name": "red-light",
        "description": "Red theme fallback - light mode",
        "color": {
          "primary": {"value": "#b00020"},
          "secondary": {"value": "#d00050"},
          "brand-custom-1": {"value": "#800000"},
          "accent": {"value": "#b00020"},
          "success": {"value": "#00a651"},
          "error": {"value": "#c00000"},
          "warning": {"value": "#ff8000"},
          "surface": {"value": "#fefefe"},
          "background": {"value": "#ffffff"},
          "on-primary": {"value": "#ffffff"},
          "on-secondary": {"value": "#ffffff"},
          "type": "color"
        },
        "semantic": {
          "primary": {"value": "{color.primary}"},
          "surface": {"value": "{color.surface}"},
          "background": {"value": "{color.background}"}
        },
        "component": {
          "header": {
            "useGradient": {"value": true, "type": "boolean"},
            "gradient": {
              "value": [
                {
                  "color": {"value": "{color.primary}"},
                  "position": 0
                },
                {
                  "color": {"value": "{color.primary}"},
                  "position": 1
                }
              ]
            },
            "background": {"value": "{semantic.surface}"}
          }
        }
      };

    case 'turquoise':
      return {
        "name": "turquoise-light",
        "description": "Turquoise theme fallback - light mode",
        "color": {
          "primary": {"value": "#00b0b0"},
          "secondary": {"value": "#00d0d0"},
          "brand-custom-1": {"value": "#008080"},
          "accent": {"value": "#00b0b0"},
          "success": {"value": "#00a651"},
          "error": {"value": "#c00000"},
          "warning": {"value": "#ff8000"},
          "surface": {"value": "#fefefe"},
          "background": {"value": "#ffffff"},
          "on-primary": {"value": "#ffffff"},
          "type": "color"
        },
        "semantic": {
          "primary": {"value": "{color.primary}"},
          "surface": {"value": "{color.surface}"},
          "background": {"value": "{color.background}"}
        },
        "component": {
          "header": {
            "useGradient": {"value": true, "type": "boolean"},
            "gradient": {
              "value": [
                {
                  "color": {"value": "{color.primary}"},
                  "position": 0
                },
                {
                  "color": {"value": "{color.primary}"},
                  "position": 1
                }
              ]
            },
            "background": {"value": "{semantic.surface}"}
          }
        }
      };

    default:
      return {
        "name": "green-light",
        "description": "Green theme fallback - light mode",
        "color": {
          "primary": {"value": "#00b020"},
          "secondary": {"value": "#00d050"},
          "brand-custom-1": {"value": "#008000"},
          "accent": {"value": "#00b020"},
          "success": {"value": "#00a651"},
          "error": {"value": "#c00000"},
          "warning": {"value": "#ff8000"},
          "surface": {"value": "#fefefe"},
          "background": {"value": "#ffffff"},
          "on-primary": {"value": "#ffffff"},
          "type": "color"
        },
        "semantic": {
          "primary": {"value": "{color.primary}"},
          "surface": {"value": "{color.surface}"},
          "background": {"value": "{color.background}"}
        },
        "component": {
          "header": {
            "useGradient": {"value": true, "type": "boolean"},
            "gradient": {
              "value": [
                {
                  "color": {"value": "{color.primary}"},
                  "position": 0
                },
                {
                  "color": {"value": "{color.primary}"},
                  "position": 1
                }
              ]
            },
            "background": {"value": "{semantic.surface}"}
          }
        }
      };
  }
}