figma2flutter 0.0.7-alpha copy "figma2flutter: ^0.0.7-alpha" to clipboard
figma2flutter: ^0.0.7-alpha copied to clipboard

This package converts Tokens Studio for Figma json exports into Flutter code.

example/lib/main.dart

import 'package:example/generated/tokens.g.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    HSLColor.fromColor(Colors.white).withLightness(0.5);
    return MaterialApp(
      title: 'Figma2Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSwatch(
          primarySwatch: Tokens.materialColor.red,
          backgroundColor: Tokens.color.white,
          accentColor: Tokens.color.purple,
        ).copyWith(
          secondary: Tokens.materialColor.yellow,
        ),
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text('Figma2Flutter')),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: const [
              _Card(),
            ],
          ),
        ),
      ),
    );
  }
}

// Example of using a CompositionToken in a Composition widget
class _Card extends StatelessWidget {
  const _Card();

  @override
  Widget build(BuildContext context) {
    return Composition(
      token: Tokens.composition.testCard,
      axis: Axis.vertical,
      children: const [
        Text(
          'Hello World',
          style: TextStyle(
            fontSize: 20,
            color: Colors.red,
            fontWeight: FontWeight.w700,
          ),
        ),
        Text('This is a composable widget based of a token'),
      ],
    );
  }
}
16
likes
0
points
315
downloads

Publisher

verified publisherappnormal.com

Weekly Downloads

This package converts Tokens Studio for Figma json exports into Flutter code.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, collection, flutter, meta, path, tinycolor2

More

Packages that depend on figma2flutter