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

Overview

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 :

You might also like...

Neumorphic style - Example app with Flutter that displays a neumorphic style container

Neumorphic style - Example app with Flutter that displays a neumorphic style container

Flutter Neumorphic Style Example App Example app with Flutter that displays a ne

Mar 24, 2022

Biyi - a convenient translation and dictionary app written in Flutter

Biyi - a convenient translation and dictionary app written in Flutter

biyi_app Biyi is a convenient translation and dictionary app written in Flutter.

Dec 28, 2022

An Android app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary.

An Android app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary.

Jisho Lens is an app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary. In a nutshell, think of it as

Sep 22, 2022

Unofficial Turkish Dictionary app of TDK (Turkish Language Association) developing with Flutter

Unofficial Turkish Dictionary app of TDK (Turkish Language Association) developing with Flutter

Turkish Dictionary Unofficial Turkish Dictionary app of TDK (Turkish Language Association) developing with Flutter Design Feyza Nur Demirci Şahin Abut

Oct 20, 2022

Tamil Dictionary - Flutter App

Tamil Dictionary - Flutter App

vasitionary A new Tamil Dictionary Flutter application. Getting Started This App is a new and first of its kind app for Tamil Language. It servers the

Nov 13, 2022

A Dictionary application being developed for the Gamo Language.

gamo_dict A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Jul 1, 2022

An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

Colours An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch. Getting Started In your flut

Nov 23, 2021

Rajagiri connect is a networking platform that enables the students of Rajagiri to form a social network among themselves, enabling them to connect with their seniors, juniors and faculty for sharing of information and resources.

Rajagiri Connect Rajagiri connect is a networking platform that enables the students of Rajagiri to form a social network among themselves, enabling t

Nov 27, 2022
Comments
  • textAlign not working for the generated text

    textAlign not working for the generated text

    Hello,

    First, I'd like to thank you for supporting flutter, Currently we have an issue we wanna change textAlign but we cannot

    FigmaText.bodyLargeMedium('test',textAlign: TextAlign.center );

    Now we have to do that:

    Text( 'text, style: TextStyle( fontSize: FigmaTextStyleData.regular() .bodyLargeRegular .fontSize, fontWeight: FigmaTextStyleData.regular() .bodyLargeRegular .fontWeight, color: FigmaColorData.regular().primaryDark), textAlign: TextAlign.center, ),

    if we can pass the textAlign too to the generated text class that would be great.

    Thanks,

    opened by mufayed 0
Owner
Aloïs Deniel
Flutter Freelance
Aloïs Deniel
Plist parser - A Plist parser for Flutter supports XML and binary Apple Property list (plist) formats

Plist Parser for Flutter ?? A Flutter Plugin for Plist parser supporting XML and

dirablue ( gaku ) 4 Nov 17, 2022
Dart library for decoding/encoding image formats, and image processing.

image Overview A Dart library providing the ability to load, save and manipulate images in a variety of different file formats. The library is written

Brendan Duncan 907 Dec 27, 2022
This is a UI inspired from a Figma design.

safariappui This is a UI inspired from a Figma design. It was created by Jerry from Twitter. Figma Design File Due to privacy issues, you can DM Jerry

Luqman Tuke 0 Dec 26, 2021
In this video we will learn how to Integrate NodeJS Login and Register API in our Flutter application using JWT Token Authentication.

Flutter Login & Register with Node JS Rest API In this video we will learn how to Integrate NodeJS Login and Register API in our Flutter application u

SnippetCoder 18 Nov 28, 2022
An intuitive Token Parser that includes grammar definition, tokenization, parsing, syntax error and debugging. Implementation based on Lexical Analysis for Dart.

Token Parser An intuitive Token Parser that includes syntax/grammar definition, tokenization and parsing. Implementation based on Lexical Analysis. Re

JUST A SNIPER ツ 2 Dec 15, 2022
A token auction website made by Flutter thats interacts with Ethereum web3 through flutter_web3 package.

flutter_web3_auction A token auction website made by Flutter thats interacts with Ethereum web3 through flutter_web3 package. This flutter web package

yoisha 26 Dec 26, 2022
Create Google reCAPTCHA v3 token for Flutter web.

g_recaptcha_v3 Create Google reCAPTCHA v3 token for Flutter web. Google reCAPTCHA v3 plugin for Flutter. A Google reCAPTCHA is a free service that pro

Bharathraj 7 Nov 30, 2022
Canton Design System elements and resources for Flutter.

Canton UI Canton UI elements and resources for Flutter. Examples in Apps Notes App News App Elisha Description This includes things such as themes (co

Carlton Aikins 10 Dec 17, 2022
Given a JSON string, this library will generate all the necessary Dart classes to parse and generate JSON.

JSON to Dart Given a JSON string, this library will generate all the necessary Dart classes to parse and generate JSON. This library is designed to ge

Javier Lecuona 1.2k Dec 25, 2022