🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

style-dictionary-figma-flutter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-dictionary-figma-flutter

Custom style-dictionary transforms and formats to generate Flutter resources from a Figma Design Token plugin export.

latest
Source
npmnpm
Version
0.6.1
Version published
Maintainers
1
Created
Source

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 :

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts