0.6.1 • Published 2 years ago

style-dictionary-figma-flutter v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

style-dictionary-figma-flutter

An extension to style-dictionary to support more custom types with Flutter as target platform. It supports the custom types from Figma's Design Token plugin.

It is an alternative to design-token-transformer package which doesn't offer great output for Flutter.

Generated dart classes :

  • Data classes for types (colors, text styles, border radiuses, edge insets, sizes, breakpoints, icons)
  • Theme inherited widget
  • Base widgets (Text, Padding, Icon)
  • Gallery widget with all styles

Usage

$ npm install -g style-dictionary-figma-flutter

Define a config.json file for your project :

{
    "source": [
        "design/**/*.json"
    ],
    "platforms": {
        "flutter": {
            "transformGroup": "figma-flutter",
            "buildPath": "./lib/",
            "files": [
                {
                    "destination": "theme/theme.g.dart",
                    "format": "flutter/theme/theme.dart",
                    "prefix": "App"
                },
                {
                    "destination": "theme/data.g.dart",
                    "format": "flutter/theme/data.dart",
                    "prefix": "App"
                },
                {
                    "destination": "theme/widgets.g.dart",
                    "format": "flutter/theme/widgets.dart",
                    "prefix": "App"
                },
                {
                    "destination": "theme/gallery.g.dart",
                    "format": "flutter/theme/gallery.dart",
                    "prefix": "App"
                }
            ]
        }
    }
}

Run the program:

$ style-dictionary-figma-flutter

Supported types

  • color
  • dimension
  • custom-radius
  • custom-spacing
  • custom-fontStyle
  • custom-icon

Example

A full example is available in the example directory.

The input files are :

The output .dart files ares also included :

0.6.1

2 years ago

0.6.0

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago