├── .DS_Store ├── figma_theme ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib │ ├── figma_theme.dart │ └── src │ │ └── annotations.dart ├── pubspec.lock └── pubspec.yaml ├── figma_theme_generator ├── .gitignore ├── .metadata ├── .vscode │ └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.yaml ├── doc │ ├── figma_library.png │ ├── result.png │ └── share.png ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── bin │ │ ├── file_response_example.json │ │ └── generate_theme.dart │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ ├── lib │ │ ├── main.dart │ │ ├── theme.dart │ │ └── theme.g.dart │ ├── pubspec.lock │ └── pubspec.yaml ├── lib │ ├── builder.dart │ ├── figma_theme_generator.dart │ └── src │ │ ├── builders │ │ ├── base.dart │ │ ├── builder.dart │ │ ├── context.dart │ │ └── nodes.dart │ │ ├── generator.dart │ │ └── helpers │ │ ├── data_class_builder.dart │ │ └── extensions.dart ├── pubspec.lock └── pubspec.yaml ├── figma_to_flutter.code-workspace ├── figma_to_flutter ├── .DS_Store ├── .gitignore ├── LICENSE ├── README.md ├── cli │ ├── bin │ │ ├── cli.dart │ │ └── sample.json │ └── pubspec.yaml ├── docs │ ├── banner.png │ ├── check.svg │ ├── component.svg │ ├── directive-tap.png │ ├── directive-widget.png │ ├── dynamic.png │ ├── favicon.ico │ ├── github.svg │ ├── index.html │ ├── logo.png │ ├── logo.svg │ ├── main.js │ ├── main.js.deps │ ├── main.js.map │ ├── prettify.css │ ├── styles.css │ └── workflow.png ├── generator │ ├── lib │ │ └── figma_to_flutter_generator.dart │ └── pubspec.yaml ├── generator_annotations │ ├── lib │ │ └── figma_to_flutter_generator_annotations.dart │ └── pubspec.yaml ├── publish.sh ├── sample │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── flutterfigmasample │ │ │ │ │ └── MainActivity.java │ │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── flutter_figma_sample.iml │ ├── flutter_figma_sample_android.iml │ ├── fonts │ │ ├── Roboto-Black.ttf │ │ ├── Roboto-BlackItalic.ttf │ │ ├── Roboto-Bold.ttf │ │ ├── Roboto-BoldItalic.ttf │ │ ├── Roboto-Italic.ttf │ │ ├── Roboto-Light.ttf │ │ ├── Roboto-LightItalic.ttf │ │ ├── Roboto-Medium.ttf │ │ ├── Roboto-MediumItalic.ttf │ │ ├── Roboto-Regular.ttf │ │ ├── Roboto-Thin.ttf │ │ └── Roboto-ThinItalic.ttf │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Runner │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── main.m │ ├── lib │ │ ├── cards │ │ │ ├── cards.dart │ │ │ ├── cards.g.dart │ │ │ └── cards.g.dart.json │ │ ├── gallery │ │ │ ├── gallery.dart │ │ │ ├── gallery.g.dart │ │ │ └── gallery.g.dart.json │ │ ├── logo.g.dart │ │ ├── logo.g.dart.json │ │ ├── main.dart │ │ └── todo │ │ │ ├── todo.dart │ │ │ ├── todo.g.dart │ │ │ └── todo.g.dart.json │ └── pubspec.yaml ├── src │ ├── lib │ │ ├── api.dart │ │ ├── base │ │ │ ├── base.dart │ │ │ ├── color.dart │ │ │ ├── constraints.dart │ │ │ ├── effect.dart │ │ │ ├── paint.dart │ │ │ ├── path.dart │ │ │ ├── text_styles.dart │ │ │ └── transform.dart │ │ ├── context.dart │ │ ├── figma_to_flutter.dart │ │ ├── file.dart │ │ ├── nodes │ │ │ ├── component.dart │ │ │ ├── directive.dart │ │ │ ├── frame.dart │ │ │ ├── group.dart │ │ │ ├── node.dart │ │ │ ├── text.dart │ │ │ └── vector.dart │ │ ├── parsing │ │ │ └── declaration.dart │ │ └── tools │ │ │ ├── code.dart │ │ │ ├── code_catalog.dart │ │ │ ├── format.dart │ │ │ └── positions.dart │ └── pubspec.yaml └── website │ ├── README.md │ ├── pubspec.yaml │ └── web │ └── main.dart └── flutter_figma ├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── example_response.json ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── .last_build_id │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── .gitignore │ ├── main.dart │ └── pages │ │ ├── component_preview.dart │ │ ├── components_list.dart │ │ └── enter_keys.dart ├── pubspec.lock └── pubspec.yaml ├── lib ├── figma.dart ├── src │ ├── design │ │ ├── design.dart │ │ └── storage.dart │ ├── figma.dart │ ├── helpers │ │ ├── api_copy_with.dart │ │ └── api_extensions.dart │ ├── rendering │ │ ├── decoration.dart │ │ └── layouts │ │ │ ├── auto_layout.dart │ │ │ ├── constrained_layout.dart │ │ │ └── rotated.dart │ └── widgets │ │ ├── blurred.dart │ │ ├── frame.dart │ │ ├── layouts │ │ ├── auto_layout.dart │ │ ├── constrained_layout.dart │ │ └── rotated.dart │ │ ├── mask.dart │ │ ├── rectangle.dart │ │ ├── text.dart │ │ ├── vector.dart │ │ └── widgets.dart └── widgets.dart ├── pubspec.lock └── pubspec.yaml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/.DS_Store -------------------------------------------------------------------------------- /figma_theme/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | build/ 33 | 34 | # Android related 35 | **/android/**/gradle-wrapper.jar 36 | **/android/.gradle 37 | **/android/captures/ 38 | **/android/gradlew 39 | **/android/gradlew.bat 40 | **/android/local.properties 41 | **/android/**/GeneratedPluginRegistrant.java 42 | 43 | # iOS/XCode related 44 | **/ios/**/*.mode1v3 45 | **/ios/**/*.mode2v3 46 | **/ios/**/*.moved-aside 47 | **/ios/**/*.pbxuser 48 | **/ios/**/*.perspectivev3 49 | **/ios/**/*sync/ 50 | **/ios/**/.sconsign.dblite 51 | **/ios/**/.tags* 52 | **/ios/**/.vagrant/ 53 | **/ios/**/DerivedData/ 54 | **/ios/**/Icon? 55 | **/ios/**/Pods/ 56 | **/ios/**/.symlinks/ 57 | **/ios/**/profile 58 | **/ios/**/xcuserdata 59 | **/ios/.generated/ 60 | **/ios/Flutter/App.framework 61 | **/ios/Flutter/Flutter.framework 62 | **/ios/Flutter/Flutter.podspec 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Exceptions to above rules. 72 | !**/ios/**/default.mode1v3 73 | !**/ios/**/default.mode2v3 74 | !**/ios/**/default.pbxuser 75 | !**/ios/**/default.perspectivev3 76 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 77 | -------------------------------------------------------------------------------- /figma_theme/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /figma_theme/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.1.1] - 2020/10/06 2 | 3 | * Added asset package. 4 | 5 | ## [0.1.0] - 2020/09/24 6 | 7 | * Initial release 8 | -------------------------------------------------------------------------------- /figma_theme/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aloïs Deniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /figma_theme/README.md: -------------------------------------------------------------------------------- 1 | # figma_theme 2 | 3 | Annotations for the [figma_theme_generator](https://pub.dev/packages/figma_theme_generator). 4 | 5 | -------------------------------------------------------------------------------- /figma_theme/lib/figma_theme.dart: -------------------------------------------------------------------------------- 1 | library figma_theme; 2 | 3 | export 'src/annotations.dart'; 4 | 5 | export 'package:collection/collection.dart'; 6 | -------------------------------------------------------------------------------- /figma_theme/lib/src/annotations.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | class FigmaTheme { 4 | final String apiToken; 5 | final String fileKey; 6 | final int version; 7 | 8 | /// Used as asset package (fontFamily, icon, ...) 9 | final String package; 10 | const FigmaTheme( 11 | this.version, { 12 | @required this.apiToken, 13 | @required this.fileKey, 14 | this.package, 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /figma_theme/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | characters: 5 | dependency: transitive 6 | description: 7 | name: characters 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.1.0-nullsafety.3" 11 | collection: 12 | dependency: "direct main" 13 | description: 14 | name: collection 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.15.0-nullsafety.3" 18 | flutter: 19 | dependency: "direct main" 20 | description: flutter 21 | source: sdk 22 | version: "0.0.0" 23 | meta: 24 | dependency: "direct main" 25 | description: 26 | name: meta 27 | url: "https://pub.dartlang.org" 28 | source: hosted 29 | version: "1.3.0-nullsafety.3" 30 | sky_engine: 31 | dependency: transitive 32 | description: flutter 33 | source: sdk 34 | version: "0.0.99" 35 | typed_data: 36 | dependency: transitive 37 | description: 38 | name: typed_data 39 | url: "https://pub.dartlang.org" 40 | source: hosted 41 | version: "1.3.0-nullsafety.3" 42 | vector_math: 43 | dependency: transitive 44 | description: 45 | name: vector_math 46 | url: "https://pub.dartlang.org" 47 | source: hosted 48 | version: "2.1.0-nullsafety.3" 49 | sdks: 50 | dart: ">=2.10.0-110 <2.11.0" 51 | flutter: ">=1.17.0 <2.0.0" 52 | -------------------------------------------------------------------------------- /figma_theme/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_theme 2 | description: Annotations for the figma_theme_generator. 3 | version: 0.1.1 4 | homepage: https://github.com/aloisdeniel/figma-to-flutter/tree/master/figma_theme 5 | 6 | environment: 7 | sdk: ">=2.7.0 <3.0.0" 8 | flutter: ">=1.17.0 <2.0.0" 9 | 10 | dependencies: 11 | meta: ^1.1.8 12 | collection: ^1.14.13 13 | flutter: 14 | sdk: flutter 15 | -------------------------------------------------------------------------------- /figma_theme_generator/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | example/lib/credentials.dart 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | .idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | build/ 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Flutter.podspec 64 | **/ios/Flutter/Generated.xcconfig 65 | **/ios/Flutter/app.flx 66 | **/ios/Flutter/app.zip 67 | **/ios/Flutter/flutter_assets/ 68 | **/ios/Flutter/flutter_export_environment.sh 69 | **/ios/ServiceDefinitions.json 70 | **/ios/Runner/GeneratedPluginRegistrant.* 71 | 72 | # Exceptions to above rules. 73 | !**/ios/**/default.mode1v3 74 | !**/ios/**/default.mode2v3 75 | !**/ios/**/default.pbxuser 76 | !**/ios/**/default.perspectivev3 77 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 78 | -------------------------------------------------------------------------------- /figma_theme_generator/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /figma_theme_generator/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "example", 9 | "cwd": "example", 10 | "request": "launch", 11 | "program": "lib/main.dart", 12 | "type": "dart" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /figma_theme_generator/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.1.8] - 2020/10/21 2 | 3 | * Upgraded figma dependency. 4 | 5 | ## [0.1.7] - 2020/10/05 6 | 7 | * Added missing generated comma. 8 | 9 | ## [0.1.6] - 2020/10/05 10 | 11 | * Added asset package. 12 | 13 | ## [0.1.5] - 2020/10/05 14 | 15 | * Fixed name formatting. 16 | 17 | ## [0.1.4] - 2020/10/05 18 | 19 | * Fixed name formatting. 20 | 21 | ## [0.1.3] - 2020/10/05 22 | 23 | * Fixed name formatting. 24 | 25 | ## [0.1.2] - 2020/10/05 26 | 27 | * Fixed name formatting. 28 | 29 | ## [0.1.1] - 2020/10/05 30 | 31 | * Upgraded figma dependency 32 | 33 | ## [0.1.0-prerelease] - 2020/09/24 34 | 35 | * Initial release 36 | -------------------------------------------------------------------------------- /figma_theme_generator/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aloïs Deniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /figma_theme_generator/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | figma_theme_generator|figma_theme_generator: 5 | enabled: true 6 | 7 | builders: 8 | figma_theme_generator: 9 | target: ":figma_theme_generator" 10 | import: "package:figma_theme_generator/builder.dart" 11 | builder_factories: ["figmaThemeGenerator"] 12 | build_extensions: {".dart": [".figma_theme.dart"]} 13 | auto_apply: dependents 14 | build_to: cache 15 | applies_builders: ["source_gen|combining_builder"] -------------------------------------------------------------------------------- /figma_theme_generator/doc/figma_library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/doc/figma_library.png -------------------------------------------------------------------------------- /figma_theme_generator/doc/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/doc/result.png -------------------------------------------------------------------------------- /figma_theme_generator/doc/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/doc/share.png -------------------------------------------------------------------------------- /figma_theme_generator/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | -------------------------------------------------------------------------------- /figma_theme_generator/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /figma_theme_generator/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /figma_theme_generator/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /figma_theme_generator/example/bin/generate_theme.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:figma_theme_generator/src/builders/builder.dart'; 5 | import 'package:figma/figma.dart'; 6 | 7 | void main() { 8 | final generator = FigmaThemeBuilder(); 9 | 10 | final content = File('file_response_example.json').readAsStringSync(); 11 | final file = FileResponse.fromJson(jsonDecode(content)); 12 | final result = generator.build('Example', null, file); 13 | 14 | File('../lib/theme_data.g.dart').writeAsStringSync(result); 15 | print('generated!'); 16 | } 17 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /figma_theme_generator/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /figma_theme_generator/example/lib/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/credentials.dart'; 2 | import 'package:figma_theme/figma_theme.dart'; 3 | import 'package:flutter/widgets.dart'; 4 | 5 | part 'theme.g.dart'; 6 | 7 | final d = BorderSide( 8 | style: BorderStyle.solid, 9 | color: Color(0xFF), 10 | width: 5.0, 11 | ); 12 | 13 | final s = BorderRadius.only(topLeft: Radius.circular(5.0)); 14 | 15 | @FigmaTheme( 16 | 1, 17 | fileKey: fileKey, 18 | apiToken: apiToken, 19 | ) 20 | class ExampleTheme extends InheritedWidget { 21 | final ExampleThemeData data; 22 | ExampleTheme({ 23 | Key key, 24 | @required Widget child, 25 | @required this.data, 26 | }) : super( 27 | key: key, 28 | child: child, 29 | ); 30 | 31 | static ExampleThemeData of(BuildContext context) { 32 | return context.dependOnInheritedWidgetOfExactType()?.data ?? 33 | ExampleThemeData.fallback(); 34 | } 35 | 36 | @override 37 | bool updateShouldNotify(ExampleTheme oldWidget) { 38 | return oldWidget.data != data; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /figma_theme_generator/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: ">=2.7.0 <3.0.0" 10 | 11 | dependencies: 12 | figma_theme: 13 | flutter: 14 | sdk: flutter 15 | cupertino_icons: ^0.1.3 16 | 17 | dev_dependencies: 18 | build_runner: 1.10.1 19 | figma_theme_generator: 20 | flutter_test: 21 | sdk: flutter 22 | 23 | dependency_overrides: 24 | figma_theme_generator: 25 | path: ../ 26 | 27 | # For information on the generic Dart part of this file, see the 28 | # following page: https://dart.dev/tools/pub/pubspec 29 | 30 | # The following section is specific to Flutter. 31 | flutter: 32 | 33 | # The following line ensures that the Material Icons font is 34 | # included with your application, so that you can use the icons in 35 | # the material Icons class. 36 | uses-material-design: true 37 | 38 | # To add assets to your application, add an assets section, like this: 39 | # assets: 40 | # - images/a_dot_burr.jpeg 41 | # - images/a_dot_ham.jpeg 42 | 43 | # An image asset can refer to one or more resolution-specific "variants", see 44 | # https://flutter.dev/assets-and-images/#resolution-aware. 45 | 46 | # For details regarding adding assets from package dependencies, see 47 | # https://flutter.dev/assets-and-images/#from-packages 48 | 49 | # To add custom fonts to your application, add a fonts section here, 50 | # in this "flutter" section. Each entry in this list should have a 51 | # "family" key with the font family name, and a "fonts" key with a 52 | # list giving the asset and other descriptors for the font. For 53 | # example: 54 | # fonts: 55 | # - family: Schyler 56 | # fonts: 57 | # - asset: fonts/Schyler-Regular.ttf 58 | # - asset: fonts/Schyler-Italic.ttf 59 | # style: italic 60 | # - family: Trajan Pro 61 | # fonts: 62 | # - asset: fonts/TrajanPro.ttf 63 | # - asset: fonts/TrajanPro_Bold.ttf 64 | # weight: 700 65 | # 66 | # For details regarding fonts from package dependencies, 67 | # see https://flutter.dev/custom-fonts/#from-packages 68 | -------------------------------------------------------------------------------- /figma_theme_generator/lib/builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:build/build.dart'; 2 | import 'package:figma_theme_generator/src/generator.dart'; 3 | import 'package:source_gen/source_gen.dart'; 4 | 5 | Builder figmaThemeGenerator(BuilderOptions options) => SharedPartBuilder( 6 | [FigmaThemeGenerator()], 7 | 'figma_theme_generator', 8 | ); 9 | -------------------------------------------------------------------------------- /figma_theme_generator/lib/figma_theme_generator.dart: -------------------------------------------------------------------------------- 1 | library figma_theme_generator; 2 | 3 | export 'src/generator.dart'; 4 | export 'src/builders/builder.dart'; 5 | -------------------------------------------------------------------------------- /figma_theme_generator/lib/src/builders/builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:dart_style/dart_style.dart'; 3 | import 'package:figma/figma.dart'; 4 | import 'package:meta/meta.dart'; 5 | 6 | import 'nodes.dart'; 7 | 8 | class FigmaThemeBuilder { 9 | final String fallbackConstructorName; 10 | const FigmaThemeBuilder({ 11 | this.fallbackConstructorName = 'fallback', 12 | }); 13 | 14 | Future download({ 15 | @required String name, 16 | @required String package, 17 | @required String apiToken, 18 | @required String fileKey, 19 | }) async { 20 | assert(apiToken != null); 21 | assert(fileKey != null); 22 | 23 | final client = FigmaClient(apiToken); 24 | final file = await client.getFile(fileKey); 25 | 26 | return build(name, package, file); 27 | } 28 | 29 | String build(String name, String package, FileResponse response) { 30 | final library = LibraryBuilder(); 31 | 32 | const FileBuilder().build( 33 | library: library, 34 | package: package, 35 | name: name, 36 | response: response, 37 | fallbackConstructorName: fallbackConstructorName, 38 | ); 39 | 40 | final emitter = DartEmitter(); 41 | final source = '${library.build().accept(emitter)}'; 42 | return DartFormatter().format(source); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /figma_theme_generator/lib/src/generator.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:analyzer/dart/element/element.dart'; 4 | import 'package:figma_theme/figma_theme.dart' as annotation; 5 | import 'package:source_gen/source_gen.dart'; 6 | import 'package:build/build.dart'; 7 | 8 | import 'builders/builder.dart'; 9 | 10 | class FigmaThemeGenerator 11 | extends GeneratorForAnnotation { 12 | const FigmaThemeGenerator(); 13 | 14 | @override 15 | FutureOr generateForAnnotatedElement( 16 | Element element, ConstantReader annotation, BuildStep buildStep) async { 17 | if (element is! ClassElement) { 18 | final name = element.name; 19 | throw InvalidGenerationSourceError('Generator cannot target `$name`.', 20 | todo: 'Remove the FigmaTheme annotation from `$name`.', 21 | element: element); 22 | } 23 | 24 | final classElement = element as ClassElement; 25 | 26 | final apiToken = 27 | annotation.objectValue.getField('apiToken').toStringValue(); 28 | final fileKey = annotation.objectValue.getField('fileKey').toStringValue(); 29 | final package = annotation.objectValue.getField('package').toStringValue(); 30 | 31 | final builder = FigmaThemeBuilder(); 32 | return await builder.download( 33 | name: classElement.displayName, 34 | package: package, 35 | apiToken: apiToken, 36 | fileKey: fileKey, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /figma_theme_generator/lib/src/helpers/extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma/figma.dart'; 2 | import 'package:meta/meta.dart'; 3 | 4 | extension NodeExtensions on Node { 5 | List extractFills() { 6 | final $this = this; 7 | if ($this is Vector) { 8 | return $this.fills; 9 | } 10 | if ($this is Frame) { 11 | return $this.fills; 12 | } 13 | if ($this is Group) { 14 | return $this.fills; 15 | } 16 | 17 | return const []; 18 | } 19 | 20 | List extractStrokes() { 21 | final $this = this; 22 | if ($this is Rectangle) { 23 | return $this.strokes 24 | .map( 25 | (p) => StrokeDefinition( 26 | paint: p, 27 | strokeWeight: $this.strokeWeight, 28 | rectangleCornerRadii: $this.rectangleCornerRadii, 29 | ), 30 | ) 31 | .toList(); 32 | } 33 | if ($this is Vector) { 34 | return $this.strokes 35 | .map( 36 | (p) => StrokeDefinition( 37 | paint: p, 38 | strokeWeight: $this.strokeWeight, 39 | ), 40 | ) 41 | .toList(); 42 | } 43 | if ($this is Frame) { 44 | return $this.strokes 45 | .map( 46 | (p) => StrokeDefinition( 47 | paint: p, 48 | strokeWeight: $this.strokeWeight, 49 | ), 50 | ) 51 | .toList(); 52 | } 53 | if ($this is Group) { 54 | return $this.strokes 55 | .map( 56 | (p) => StrokeDefinition( 57 | paint: p, 58 | strokeWeight: $this.strokeWeight, 59 | ), 60 | ) 61 | .toList(); 62 | } 63 | 64 | return const []; 65 | } 66 | 67 | List extractEffects() { 68 | final $this = this; 69 | if ($this is Vector) { 70 | return $this.effects; 71 | } 72 | if ($this is Frame) { 73 | return $this.effects; 74 | } 75 | if ($this is Group) { 76 | return $this.effects; 77 | } 78 | 79 | return const []; 80 | } 81 | } 82 | 83 | class StrokeDefinition { 84 | final double strokeWeight; 85 | final Paint paint; 86 | final List rectangleCornerRadii; 87 | const StrokeDefinition({ 88 | @required this.strokeWeight, 89 | @required this.paint, 90 | this.rectangleCornerRadii = const [], 91 | }); 92 | } 93 | -------------------------------------------------------------------------------- /figma_theme_generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_theme_generator 2 | description: Generate themes from Figma styles. 3 | version: 0.1.8 4 | homepage: https://github.com/aloisdeniel/figma-to-flutter/tree/master/figma_theme_generator 5 | 6 | environment: 7 | sdk: ">=2.7.0 <3.0.0" 8 | flutter: ">=1.17.0 <2.0.0" 9 | 10 | dependencies: 11 | figma_theme: ^0.1.1 12 | recase: ^3.0.0 13 | analyzer: ^0.39.14 14 | code_builder: ^3.2.0 15 | build: ^1.0.0 16 | source_gen: ^0.9.7 17 | meta: ^1.1.8 18 | dart_style: ^1.3.6 19 | figma: ^2.0.3 20 | 21 | flutter: 22 | sdk: flutter 23 | -------------------------------------------------------------------------------- /figma_to_flutter.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "name": "Theme", 5 | "path": "figma_theme" 6 | }, 7 | { 8 | "name": "Theme Generator", 9 | "path": "figma_theme_generator" 10 | }, 11 | { 12 | "name": "Flutter Figma", 13 | "path": "flutter_figma" 14 | }, 15 | ], 16 | "settings": { 17 | "git.ignoreLimitWarning": true, 18 | "editor.formatOnPaste": true, 19 | "editor.formatOnSave": true, 20 | "editor.formatOnType": true, 21 | "dart.flutterSdkPath": "/Users/alois/Sources/flutter" 22 | } 23 | } -------------------------------------------------------------------------------- /figma_to_flutter/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/.DS_Store -------------------------------------------------------------------------------- /figma_to_flutter/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Files and directories created by pub 4 | .dart_tool/ 5 | .packages 6 | .pub/ 7 | build/ 8 | # If you're building an application, you may want to check-in your pubspec.lock 9 | pubspec.lock 10 | 11 | # Directory created by dartdoc 12 | # If you don't generate documentation locally you can remove this line. 13 | doc/api/ 14 | -------------------------------------------------------------------------------- /figma_to_flutter/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Aloïs Deniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /figma_to_flutter/cli/bin/cli.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:args/args.dart'; 5 | import 'package:figma_to_flutter/figma_to_flutter.dart'; 6 | import 'package:http/http.dart'; 7 | 8 | 9 | void main(List args) async { 10 | 11 | var parser = new ArgParser(); 12 | parser.addOption('token', abbr: 't'); 13 | parser.addOption('fileKey', abbr: 'f'); 14 | parser.addMultiOption('widget', abbr: 'w'); 15 | parser.addOption('output', abbr: 'o'); 16 | parser.addFlag('withComments', abbr: 'c', defaultsTo: false); 17 | parser.addFlag('withDataClasses', abbr: 'd', defaultsTo: true); 18 | 19 | var results = parser.parse(args); 20 | 21 | // check 22 | if(results["token"] == null) return print("a token must be provided"); 23 | if(results["output"] == null) return print("an ouput file path must be provided"); 24 | if(results["fileKey"] == null) return print("a fileKey must be provided"); 25 | 26 | var api = FigmaApiGenerator(Client(), results["token"]); 27 | var file = await api.getFile(results["fileKey"]); 28 | 29 | await (new File(results["output"] + ".json")).writeAsString(json.encode(file)); 30 | 31 | var generator = FigmaGenerator(file); 32 | 33 | var widgets = Map(); 34 | (results["widget"] ?? []).forEach((w) { 35 | widgets[w] = w; 36 | }); 37 | 38 | try { 39 | var code = generator.generateComponents(widgets, withComments: results["withComments"], withDataClasses: results["withDataClasses"]); 40 | // Writing to file 41 | 42 | await (new File(results["output"])).writeAsString(code); 43 | } 44 | catch(e) { 45 | if(e is FigmaFormattingException) { 46 | // Writing to file 47 | print(e.inner); 48 | await (new File(results["output"] + ".error.dart")).writeAsString(e.code); 49 | } 50 | else { 51 | // Writing to file 52 | print(e); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /figma_to_flutter/cli/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_to_flutter_cli 2 | description: A cli for converting Figma files to Flutter widgets. 3 | authors: 4 | - Aloïs Deniel 5 | environment: 6 | sdk: '>=2.0.0-dev.67.0 <2.0.0' 7 | 8 | dependencies: 9 | args: 1.4.4 10 | figma_to_flutter: 11 | 12 | dependency_overrides: 13 | figma_to_flutter: 14 | path: ../src -------------------------------------------------------------------------------- /figma_to_flutter/docs/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/banner.png -------------------------------------------------------------------------------- /figma_to_flutter/docs/check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /figma_to_flutter/docs/component.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /figma_to_flutter/docs/directive-tap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/directive-tap.png -------------------------------------------------------------------------------- /figma_to_flutter/docs/directive-widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/directive-widget.png -------------------------------------------------------------------------------- /figma_to_flutter/docs/dynamic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/dynamic.png -------------------------------------------------------------------------------- /figma_to_flutter/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/favicon.ico -------------------------------------------------------------------------------- /figma_to_flutter/docs/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /figma_to_flutter/docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/logo.png -------------------------------------------------------------------------------- /figma_to_flutter/docs/prettify.css: -------------------------------------------------------------------------------- 1 | .prettyprint{ 2 | font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace; 3 | font-size: 11px; 4 | border:0!important 5 | } 6 | 7 | .pln{color:#ebf8ff} 8 | ol.linenums{margin-top:0;margin-bottom:0;color:#686E7E} 9 | li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:transparent;list-style-type:decimal} 10 | @media screen{.str{color:#F24E1E}.kwd{color:#A259FF}.com{color:#686E7E}.typ{color:#1ABCFE}.lit{color: #0ACF83}.pun{color:#ebf8ff}.opn{color:#ebf8ff}.clo{color:#ebf8ff}.tag{color:#0ACF83}.atn{color:#0ACF83}.atv{color:#0ACF83}.dec{color:#0ACF83}.var{color:#0ACF83}.fun{color:#1ABCFE}} -------------------------------------------------------------------------------- /figma_to_flutter/docs/styles.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Roboto); 2 | @import url(https://fonts.googleapis.com/css?family=Permanent+Marker); 3 | 4 | html, body { 5 | width: 100%; 6 | height: 100%; 7 | margin: 0; 8 | padding: 0; 9 | font-family: 'Roboto', sans-serif; 10 | } 11 | 12 | .column { 13 | flex: 50%; 14 | margin:0px; 15 | padding: 0px; 16 | overflow: scroll; 17 | } 18 | 19 | pre { 20 | height: 100%; 21 | margin:0px; 22 | padding: 0px; 23 | } 24 | 25 | /* Clear floats after the columns */ 26 | .row { 27 | display: flex; 28 | height: 100%; 29 | } 30 | 31 | #form { 32 | margin: 20px; 33 | } 34 | 35 | .field{ 36 | display: flex; 37 | flex-direction: row; 38 | margin-top: 10px; 39 | } 40 | 41 | a { 42 | color: #30c2ff; 43 | text-decoration: none; 44 | } 45 | 46 | p { 47 | font-size: 14px; 48 | } 49 | 50 | #logo { 51 | width: 64px; 52 | height: 64px; 53 | } 54 | 55 | #copy { 56 | display: block; 57 | position: fixed; 58 | right: 10px; 59 | top: 10px; 60 | } 61 | 62 | input[type='text'] { 63 | font-size: 15px; 64 | border: 0px; 65 | } 66 | 67 | button { 68 | margin-top: 10px; 69 | color: #fff; 70 | background-color: #30c2ff; 71 | border-color: #30c2ff; 72 | padding: 0 11px; 73 | border-radius: 3px; 74 | line-height: 28px; 75 | } 76 | 77 | h3 { 78 | margin-top: 40px; 79 | font-size: 20px; 80 | color: #555; 81 | } 82 | 83 | #components { 84 | margin: 0px; 85 | margin-top: 10px; 86 | padding: 0px; 87 | } 88 | 89 | pre.prettyprint { 90 | border: 0px; 91 | padding: 10px; 92 | background: transparent; 93 | } 94 | 95 | .column.result { 96 | background: #2F323A; 97 | } 98 | 99 | .not-visible { 100 | display: none; 101 | } 102 | 103 | .component { 104 | cursor: pointer; 105 | list-style: none; 106 | margin-top: 10px; 107 | opacity: 0.35; 108 | } 109 | 110 | .component.selected { 111 | opacity: 1.0; 112 | } 113 | 114 | .component img { 115 | width: 18px; 116 | height: 18px; 117 | display: block; 118 | float:left; 119 | margin-right: 10px; 120 | } 121 | 122 | .component h2 { 123 | font-size: 16px; 124 | } 125 | .component .checkbox { 126 | margin: 0px; 127 | width: 18px; 128 | height: 18px; 129 | display: block; 130 | background-color: #eeeeee; 131 | border-radius: 3px; 132 | float:right; 133 | margin-left: 10px; 134 | } 135 | .component .checkbox img { 136 | display: none; 137 | } 138 | .component.selected .checkbox img { 139 | display: inline; 140 | } 141 | 142 | -------------------------------------------------------------------------------- /figma_to_flutter/docs/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/docs/workflow.png -------------------------------------------------------------------------------- /figma_to_flutter/generator/lib/figma_to_flutter_generator.dart: -------------------------------------------------------------------------------- 1 | import 'package:source_gen/source_gen.dart'; 2 | 3 | class BuiltFigmaGenerator extends Generator { 4 | const BuiltFigmaGenerator(); 5 | //TODO 6 | } -------------------------------------------------------------------------------- /figma_to_flutter/generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_to_flutter_generator 2 | description: A build generator for converting Figma files to Flutter widgets. 3 | authors: 4 | - Aloïs Deniel 5 | environment: 6 | sdk: '>=2.0.0-dev <3.0.0' 7 | 8 | dependencies: 9 | analyzer: ^0.32.1 10 | analyzer_plugin: '0.0.1-alpha.3' 11 | build: ^0.12.0 12 | build_config: ^0.3.1 13 | built_collection: '>=2.0.0 <4.0.0' 14 | figma_to_flutter: 15 | 16 | dev_dependencies: 17 | build_test: ^0.10.0 18 | build_runner: ^0.9.0 19 | test: ^1.0.0 20 | 21 | dependency_overrides: 22 | figma_to_flutter: 23 | path: ../src -------------------------------------------------------------------------------- /figma_to_flutter/generator_annotations/lib/figma_to_flutter_generator_annotations.dart: -------------------------------------------------------------------------------- 1 | class FigmaFile { 2 | final String key; 3 | const FigmaFile(this.key); 4 | } 5 | 6 | class FigmaComponent { 7 | final String name; 8 | final String generatedName; 9 | const FigmaComponent(this.name, {this.generatedName = null}); 10 | } -------------------------------------------------------------------------------- /figma_to_flutter/generator_annotations/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_to_flutter_generator_annotations 2 | description: Annotations for the build generator that converts Figma files to Flutter widgets. 3 | authors: 4 | - Aloïs Deniel 5 | environment: 6 | sdk: '>=2.0.0-dev <3.0.0' 7 | -------------------------------------------------------------------------------- /figma_to_flutter/publish.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/publish.sh -------------------------------------------------------------------------------- /figma_to_flutter/sample/README.md: -------------------------------------------------------------------------------- 1 | # Sample 2 | 3 | ## Generation 4 | 5 | To trigger a generation, use the cli with this command from the root of the repo : 6 | 7 | ```bash 8 | dart cli/bin/cli.dart -t -f -w Logo -o sample/lib/widgets/sample.g.dart 9 | dart cli/bin/cli.dart -t -f -w Logo -w Constraints_1 -w Constraints_nested -w Landscape_simple -w Landscape_effects -w Goups -w Frames -w Goups2 -w MultiGoups -o sample/lib/gallery/gallery.g.dart -c 10 | ``` -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.class 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | GeneratedPluginRegistrant.java 11 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | apply plugin: 'com.android.application' 15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 16 | 17 | android { 18 | compileSdkVersion 27 19 | 20 | lintOptions { 21 | disable 'InvalidPackage' 22 | } 23 | 24 | defaultConfig { 25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 26 | applicationId "com.example.flutterfigmasample" 27 | minSdkVersion 16 28 | targetSdkVersion 27 29 | versionCode 1 30 | versionName "1.0" 31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 32 | } 33 | 34 | buildTypes { 35 | release { 36 | // TODO: Add your own signing config for the release build. 37 | // Signing with the debug keys for now, so `flutter run --release` works. 38 | signingConfig signingConfigs.debug 39 | } 40 | } 41 | } 42 | 43 | flutter { 44 | source '../..' 45 | } 46 | 47 | dependencies { 48 | testImplementation 'junit:junit:4.12' 49 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 51 | } 52 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/java/com/example/flutterfigmasample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutterfigmasample; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.0.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/flutter_figma_sample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/flutter_figma_sample_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Black.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-BlackItalic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Italic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-LightItalic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-MediumItalic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-Thin.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/fonts/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/fonts/Roboto-ThinItalic.ttf -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/app.flx 37 | /Flutter/app.zip 38 | /Flutter/flutter_assets/ 39 | /Flutter/App.framework 40 | /Flutter/Flutter.framework 41 | /Flutter/Generated.xcconfig 42 | /ServiceDefinitions.json 43 | 44 | Pods/ 45 | .symlinks/ 46 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_figma_sample 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/lib/cards/cards.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_figma_sample/cards/cards.g.dart'; 5 | 6 | class CardsPage extends StatelessWidget { 7 | 8 | Widget _buildCard(BuildContext constext, int i) => Container( 9 | margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), 10 | constraints: BoxConstraints.expand(height: 128.0), 11 | child: Card1( 12 | title: TextData(text: "Test $i"), 13 | loveCount: TextData(text: min(i * 3 * 10 + i, 99).toString()), 14 | imageProvider: NetworkImage("https://picsum.photos/801?image=${i * 5}"), 15 | ) 16 | ); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return ListView.builder( 21 | itemBuilder: _buildCard, 22 | itemCount: 20, 23 | ); 24 | } 25 | } 26 | 27 | class Sample { 28 | final String name; 29 | final WidgetBuilder builder; 30 | Sample(this.name, this.builder); 31 | } -------------------------------------------------------------------------------- /figma_to_flutter/sample/lib/gallery/gallery.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_figma_sample/gallery/gallery.g.dart'; 3 | 4 | class GalleryPage extends StatelessWidget { 5 | 6 | final samples = [ 7 | Sample("Logo", (b) => Logo()), 8 | Sample("Constraints1", (b) => Constraints1()), 9 | Sample("ConstraintsNested", (b) => ConstraintsNested()), 10 | Sample("LandscapeSimple", (b) => LandscapeSimple()), 11 | Sample("LandscapeEffects", (b) => LandscapeEffects()), 12 | Sample("Goups", (b) => Goups()), 13 | Sample("Frames", (b) => Frames()), 14 | Sample("Goups2", (b) => Goups2()), 15 | Sample("MultiGoups", (b) => MultiGoups()), 16 | ]; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return ListView.builder( 21 | itemBuilder: (b,i) => Column( 22 | children:[ 23 | Container( 24 | margin: EdgeInsets.only(top: 20.0, left: 10.0, right: 10.0), 25 | child: Text(samples[i].name), 26 | ), 27 | Container( 28 | margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), 29 | constraints: BoxConstraints.expand(height: 300.0), 30 | child: samples[i].builder(b) 31 | ), 32 | ] 33 | ), 34 | itemCount: samples.length, 35 | ); 36 | } 37 | } 38 | 39 | class Sample { 40 | final String name; 41 | final WidgetBuilder builder; 42 | Sample(this.name, this.builder); 43 | } -------------------------------------------------------------------------------- /figma_to_flutter/sample/lib/main.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_figma_sample/cards/cards.dart'; 5 | import 'package:flutter_figma_sample/gallery/gallery.dart'; 6 | import 'package:flutter_figma_sample/logo.g.dart'; 7 | import 'package:flutter_figma_sample/todo/todo.dart'; 8 | import 'package:flutter_figma_sample/todo/todo.g.dart'; 9 | 10 | void main() => runApp(new MyApp()); 11 | 12 | var appBarColor = Color(0xFF343841); 13 | 14 | class MyApp extends StatelessWidget { 15 | // This widget is the root of your application. 16 | @override 17 | Widget build(BuildContext context) { 18 | return new MaterialApp( 19 | title: 'Figma to Flutter', 20 | theme: new ThemeData( 21 | primarySwatch: Colors.blue, 22 | ), 23 | home: HomePage() 24 | ); 25 | } 26 | } 27 | 28 | class HomePage extends StatelessWidget { 29 | final samples = [ 30 | Sample("Todo", (b) => TodoPage()), 31 | Sample("Gallery", (b) => GalleryPage()), 32 | Sample("Cards", (b) => CardsPage()), 33 | ]; 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | backgroundColor: appBarColor, 40 | title: Container( 41 | constraints: BoxConstraints.expand(height: 40.80, width: 28.10), 42 | child: Logo(), 43 | ) 44 | ), 45 | body:ListView.builder(itemBuilder:(b,i) => SampleCell(samples[i]), itemCount: samples.length) 46 | ); 47 | } 48 | } 49 | 50 | class Sample { 51 | final String name; 52 | final WidgetBuilder builder; 53 | Sample(this.name, this.builder); 54 | } 55 | 56 | class SampleCell extends StatelessWidget { 57 | final Sample sample; 58 | SampleCell(this.sample); 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return GestureDetector( 63 | onTap: () { 64 | Navigator.push( 65 | context, 66 | MaterialPageRoute(builder: (b) => Scaffold( 67 | appBar: AppBar( 68 | backgroundColor: appBarColor, 69 | title: Text(this.sample.name), 70 | ), 71 | body: this.sample.builder(b) 72 | ), 73 | )); 74 | }, 75 | child:Card( 76 | child: Container( 77 | margin: EdgeInsets.all(20.0), 78 | child: Text(this.sample.name), 79 | ) 80 | ) 81 | ); 82 | } 83 | } 84 | 85 | /** 86 | home: Stack(children: [ 87 | TodoPage(), 88 | Align( 89 | alignment: Alignment.topLeft, 90 | child: 91 | Container( 92 | constraints: BoxConstraints.expand( 93 | width: 50.0, 94 | height: 100.0,), 95 | child:Transform.translate( 96 | child: Text("X"), 97 | offset: Offset(0.0,0.0), 98 | )) 99 | ) 100 | 101 | ]), 102 | */ -------------------------------------------------------------------------------- /figma_to_flutter/sample/lib/todo/todo.dart: -------------------------------------------------------------------------------- 1 | //@FigmaFile("KJFHKJH498595NFJKNFKJN") 2 | //@FigmaComponent("Logo") 3 | library sample; 4 | 5 | import 'dart:math'; 6 | 7 | import 'package:flutter/widgets.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'todo.g.dart'; 10 | 11 | class TodoPage extends StatefulWidget { 12 | @override 13 | _TodoPageState createState() => _TodoPageState(); 14 | } 15 | 16 | class Todo { 17 | bool isSelected = false; 18 | final String title; 19 | Todo(this.title); 20 | void toggle() => this.isSelected = !this.isSelected; 21 | } 22 | 23 | class _TodoPageState extends State { 24 | 25 | TextEditingController _editing = TextEditingController(); 26 | 27 | List todos = []; 28 | 29 | void _orderTodos() { 30 | this.todos.sort((a,b) { 31 | if(!a.isSelected && b.isSelected) 32 | return -1; 33 | if(a.isSelected && !b.isSelected) 34 | return 1; 35 | return a.title.compareTo(b.title); 36 | }); 37 | } 38 | 39 | Widget _buildLogo() => Container( 40 | margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), 41 | constraints: BoxConstraints.expand(height: 200.0), 42 | child: TodoLogo(), 43 | ); 44 | 45 | Widget _buildHeader() => Container( 46 | margin: EdgeInsets.all(10.0), 47 | constraints: BoxConstraints.expand(height: 48.0), 48 | child: AddTodo( 49 | value: TextField( 50 | controller: _editing, 51 | decoration: InputDecoration( 52 | border: InputBorder.none, 53 | hintText: 'Enter a new task' 54 | ), 55 | onSubmitted: (text) { 56 | this.setState(() { 57 | todos.add(new Todo(text)); 58 | _editing.clear(); 59 | _orderTodos(); 60 | }); 61 | }, 62 | ) 63 | ) 64 | ); 65 | 66 | Widget _buildItem(int i) => Container( 67 | margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), 68 | constraints: BoxConstraints.expand(height: 58.0), 69 | child: TodoItem( 70 | title: TextData(text: todos[i].title), 71 | selected: VectorData(isVisible: todos[i].isSelected), 72 | onSelect: (){ 73 | print("selected"); 74 | this.setState(() { 75 | todos[i].toggle(); 76 | _orderTodos(); 77 | }); 78 | }), 79 | ); 80 | 81 | @override 82 | Widget build(BuildContext context) { 83 | 84 | return new Scaffold( 85 | backgroundColor: Colors.white, 86 | body: SafeArea(child:ListView.builder( 87 | itemCount: todos.length + 2, 88 | itemBuilder: (b,i){ 89 | if(i == 0) return _buildLogo(); 90 | if(i == 1) return _buildHeader(); 91 | return _buildItem(i- 2); 92 | }, 93 | ))); 94 | } 95 | } 96 | 97 | -------------------------------------------------------------------------------- /figma_to_flutter/sample/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_figma_sample 2 | description: A new Flutter project. 3 | 4 | dependencies: 5 | path_drawing: 6 | figma_to_flutter_generator_annotations: 7 | path: ../generator_annotations 8 | flutter: 9 | sdk: flutter 10 | 11 | # The following adds the Cupertino Icons font to your application. 12 | # Use with the CupertinoIcons class for iOS style icons. 13 | cupertino_icons: ^0.1.2 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://www.dartlang.org/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | 26 | # The following line ensures that the Material Icons font is 27 | # included with your application, so that you can use the icons in 28 | # the material Icons class. 29 | uses-material-design: true 30 | 31 | # To add assets to your application, add an assets section, like this: 32 | # assets: 33 | # - images/a_dot_burr.jpeg 34 | # - images/a_dot_ham.jpeg 35 | 36 | # An image asset can refer to one or more resolution-specific "variants", see 37 | # https://flutter.io/assets-and-images/#resolution-aware. 38 | 39 | # For details regarding adding assets from package dependencies, see 40 | # https://flutter.io/assets-and-images/#from-packages 41 | 42 | # To add custom fonts to your application, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | fonts: 48 | - family: Roboto 49 | fonts: 50 | - asset: fonts/Roboto-Thin.ttf 51 | weight: 100 52 | - asset: fonts/Roboto-Light.ttf 53 | weight: 300 54 | - asset: fonts/Roboto-Regular.ttf 55 | weight: 400 56 | - asset: fonts/Roboto-Medium.ttf 57 | weight: 600 58 | - asset: fonts/Roboto-Bold.ttf 59 | weight: 700 60 | - asset: fonts/Roboto-Black.ttf 61 | weight: 900 62 | # 63 | # For details regarding fonts from package dependencies, 64 | # see https://flutter.io/custom-fonts/#from-packages 65 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/api.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'package:http/http.dart'; 4 | 5 | class FigmaApiGenerator { 6 | final String authToken; 7 | final BaseClient http; 8 | 9 | FigmaApiGenerator(this.http, this.authToken); 10 | 11 | Future getFile(String fileKey) async { 12 | var response = await http.get( 13 | "https://api.figma.com/v1/files/$fileKey?geometry=paths", 14 | headers: { 15 | "X-FIGMA-TOKEN": this.authToken, 16 | }); 17 | return json.decode(response.body); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/base.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | /** 4 | * Converts a Figma point node or size reference to a [Point]. 5 | * 6 | * If given value is `null`, then returns `(0.0, 0.0)`. 7 | */ 8 | Point toPoint(dynamic map) { 9 | if (map == null) { 10 | return Point(0.0, 0.0); 11 | } 12 | 13 | var w = map["width"] ?? map["x"]; 14 | var h = map["height"] ?? map["y"]; 15 | return Point(w.toDouble(), h.toDouble()); 16 | } -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/color.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/tools/code_catalog.dart'; 3 | 4 | /** 5 | * A code generator that translates Figma color nodes into 6 | * Flutter [Color] equivalents. 7 | * 8 | * Since Figma color components are doubles (from 0.0 to 1.0), 9 | * a byte representation (from 0 to 255) is calculated. 10 | */ 11 | class ColorGenerator { 12 | CodeCatalog catalog = CodeCatalog("_ColorCatalog", "Color"); 13 | 14 | Code generate(dynamic map, {double opacity = 1.0}) { 15 | var r = map["r"].toDouble(); 16 | var g = map["g"].toDouble(); 17 | var b = map["b"].toDouble(); 18 | var a = map["a"].toDouble(); 19 | 20 | var ir = (r * 255).toInt(); 21 | var ig = (g * 255).toInt(); 22 | var ib = (b * 255).toInt(); 23 | var ia = (a * opacity * 255).toInt(); 24 | 25 | return catalog.get("Color.fromARGB($ia, $ir, $ig, $ib)"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma_to_flutter/tools/code_catalog.dart'; 2 | 3 | import 'color.dart'; 4 | import 'package:code_builder/code_builder.dart'; 5 | 6 | /** 7 | * A code generator that translates Figma effect nodes into 8 | * Flutter [Paint] equivalents. 9 | * 10 | * Warning: It only supports **drop shadows** at the moment. 11 | */ 12 | class EffectsGenerator { 13 | final ColorGenerator _color; 14 | 15 | CodeCatalog catalog = CodeCatalog("_EffectCatalog", "Paint"); 16 | 17 | EffectsGenerator(this._color); 18 | 19 | Code generate(dynamic map) { 20 | var type = map["type"]; 21 | 22 | if (type.startsWith("DROP_SHADOW")) { 23 | var color = _color.generate(map["color"]); 24 | var radius = map["radius"].toDouble(); 25 | 26 | return catalog.get("(Paint()\n" + 27 | "..color = $color\n" + 28 | "..maskFilter = MaskFilter.blur(BlurStyle.normal, BoxShadow.convertRadiusToSigma($radius))" + 29 | ")"); 30 | } 31 | 32 | return catalog.get("Paint()"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/paint.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:figma_to_flutter/tools/code_catalog.dart'; 4 | import 'color.dart'; 5 | import 'package:code_builder/code_builder.dart'; 6 | 7 | /** 8 | * A code generator that translates Figma fill and stroke nodes 9 | * into Flutter [Paint] equivalents. 10 | * 11 | * Warning: It only supports **solid, linear and radial gradients** paints. 12 | */ 13 | class PaintGenerator { 14 | final ColorGenerator _color; 15 | 16 | CodeCatalog catalog = CodeCatalog("_PaintCatalog", "Paint"); 17 | 18 | PaintGenerator(this._color); 19 | 20 | Point _toPoint(dynamic map) { 21 | var x = map["x"].toDouble(); 22 | var y = map["y"].toDouble(); 23 | return new Point(x, y); 24 | } 25 | 26 | Code _generateAlignment(Point point) { 27 | return Code("Alignment(${point.x}, ${point.y})"); 28 | } 29 | 30 | Code generate(dynamic map) { 31 | var type = map["type"]; 32 | var opacity = map["opacity"]?.toDouble() ?? 1.0; 33 | 34 | if (type == "SOLID") { 35 | var color = _color.generate(map["color"], opacity: opacity); 36 | return catalog.get("(Paint()..color = $color)"); 37 | } else if (type.startsWith("GRADIENT_")) { 38 | var local = (frame) => frame.toString(); 39 | // Handles 40 | var gradientHandlePositions = map["gradientHandlePositions"]; 41 | var begin = _toPoint(gradientHandlePositions[0]); 42 | var end = _toPoint(gradientHandlePositions[1]); 43 | begin = new Point((begin.x - 0.5) * 2.0, (begin.y - 0.5) * 2.0); 44 | end = new Point((end.x - 0.5) * 2.0, (end.y - 0.5) * 2.0); 45 | var beginAlignment = _generateAlignment(begin); 46 | var endAlignment = _generateAlignment(end); 47 | 48 | // Stops 49 | var gradientStops = map["gradientStops"]; 50 | var stopValues = gradientStops 51 | .map((x) => x["position"].toDouble()) 52 | .toList() 53 | .cast(); 54 | var stops = "[" + stopValues.join(", ") + "]"; 55 | 56 | // Colors 57 | var colorValues = gradientStops 58 | .map((x) => _color.generate(x["color"], opacity: opacity)) 59 | .toList(); 60 | var colors = "[" + colorValues.join(", ") + "]"; 61 | var gradient = null; 62 | 63 | if (type == "GRADIENT_LINEAR") { 64 | gradient = new Code("LinearGradient(" + 65 | "begin: $beginAlignment, " + 66 | "end: $endAlignment, " + 67 | "stops: $stops, " + 68 | "colors: $colors, " + 69 | "tileMode: TileMode.clamp" + 70 | ")"); 71 | } else if (type == "GRADIENT_RADIAL") { 72 | var radius = (end.x - begin.x).abs(); 73 | gradient = new Code("RadialGradient(" + 74 | "center: $beginAlignment, " + 75 | "radius: $radius, " + 76 | "stops: $stops, " + 77 | "colors: $colors, " + 78 | "tileMode: TileMode.clamp" + 79 | ")"); 80 | } 81 | 82 | if (gradient != null) { 83 | return Code( 84 | "(Paint()..shader = $gradient.createShader(Offset.zero & frame.size))"); 85 | } 86 | } 87 | 88 | return catalog.get("Paint()"); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/path.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/tools/format.dart'; 3 | import 'package:path_parsing/path_parsing.dart'; 4 | 5 | /** 6 | * A code generator that translates Figma path data 7 | * into Flutter [Path] equivalents. 8 | */ 9 | class PathGenerator { 10 | int _index = 0; 11 | ClassBuilder _catalog = new ClassBuilder()..name = "_PathCatalog"; 12 | 13 | PathGenerator() {} 14 | 15 | Class buildCatalog() { 16 | var constructorBody = BlockBuilder(); 17 | 18 | for (var i = 0; i < _index; i++) { 19 | _catalog.fields.add(Field((b) => b 20 | ..name = "path_$i" 21 | ..type = refer("Path"))); 22 | constructorBody.statements..add(Code("this.path_$i = _build_$i();")); 23 | } 24 | 25 | _catalog.fields.add(Field((b) => b 26 | ..name = "instance" 27 | ..static = true 28 | ..modifier = FieldModifier.final$ 29 | ..type = refer(_catalog.name) 30 | ..assignment = Code(_catalog.name + "()"))); 31 | 32 | _catalog.constructors 33 | .add(Constructor((b) => b..body = constructorBody.build())); 34 | 35 | return _catalog.build(); 36 | } 37 | 38 | int _addPath(map) { 39 | var statement = List(); 40 | var svg = map["path"] as String; 41 | 42 | if (svg == null) { 43 | statement = [Code("Path()")]; 44 | } else if (svg == '') { 45 | statement = [Code("Path()")]; 46 | } else { 47 | var code = _CodePath(statement); 48 | writeSvgPathDataToPath(svg, code); 49 | } 50 | var method = Method((b) => b 51 | ..name = "_build_$_index" 52 | ..static = true 53 | ..returns = refer("Path") 54 | ..body = Block((c) => c.statements 55 | ..add(new Code("var path = Path();")) 56 | ..addAll(statement) 57 | ..add(new Code("return path;")))); 58 | 59 | _catalog.methods.add(method); 60 | 61 | _index++; 62 | return _index - 1; 63 | } 64 | 65 | Code generate(map) { 66 | var index = _addPath(map); 67 | return Code("${_catalog.name}.instance.path_${index}"); 68 | } 69 | } 70 | 71 | class _CodePath extends PathProxy { 72 | final List statements; 73 | 74 | _CodePath(this.statements); 75 | 76 | @override 77 | void close() => statements.add(Code("path.close();")); 78 | 79 | @override 80 | void cubicTo( 81 | double x1, double y1, double x2, double y2, double x3, double y3) => 82 | statements.add(Code( 83 | "path.cubicTo(${toFixedDouble(x1)}, ${toFixedDouble(y1)}, ${toFixedDouble( 84 | x2)}, ${toFixedDouble(y2)}, ${toFixedDouble(x3)}, ${toFixedDouble(y3)});")); 85 | 86 | @override 87 | void lineTo(double x, double y) => statements 88 | .add(Code("path.lineTo(${toFixedDouble(x)}, ${toFixedDouble(y)});")); 89 | 90 | @override 91 | void moveTo(double x, double y) => statements 92 | .add(Code("path.moveTo(${toFixedDouble(x)}, ${toFixedDouble(y)});")); 93 | } 94 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/text_styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/tools/code_catalog.dart'; 3 | import 'package:figma_to_flutter/tools/format.dart'; 4 | 5 | /** 6 | * A code generator that translates Figma text style nodes 7 | * into Flutter [TextStyle] equivalents. 8 | */ 9 | class TextStyleGenerator { 10 | CodeCatalog catalog = CodeCatalog("_TextStyleCatalog", "ui.TextStyle"); 11 | 12 | Code generate(dynamic map, String color) { 13 | var fontSize = map["fontSize"].toDouble(); 14 | var textAlignHorizontal = map["textAlignHorizontal"] as String; 15 | var textAlignVertical = map["textAlignVertical"] as String; 16 | var fontFamily = map["fontFamily"] as String; 17 | var letterSpacing = map["letterSpacing"].toDouble(); 18 | var lineHeightPx = map["lineHeightPx"].toDouble(); 19 | var lineHeightPercent = map["letterSpacing"].toDouble(); 20 | var fontWeight = map["fontWeight"].toInt(); 21 | 22 | return catalog.get("ui.TextStyle(" + 23 | "fontFamily: '$fontFamily'," + 24 | "color: $color," + 25 | "fontSize: ${toFixedDouble(fontSize)}," + 26 | "fontWeight: FontWeight.w$fontWeight," + 27 | ")"); 28 | } 29 | } 30 | 31 | /** 32 | * A code generator that translates Figma text style nodes 33 | * into Flutter [ParagraphStyle] equivalents. 34 | */ 35 | class ParagraphStyleGenerator { 36 | String _generateTextAlign(String value) { 37 | switch (value) { 38 | case "RIGHT": 39 | return "TextAlign.right"; 40 | case "CENTER": 41 | return "TextAlign.center"; 42 | case "JUSTIFIED": 43 | return "TextAlign.justify"; 44 | default: 45 | return "TextAlign.left"; 46 | } 47 | } 48 | 49 | Code generate(dynamic map) { 50 | var fontSize = map["fontSize"].toDouble(); 51 | var textAlignHorizontal = 52 | _generateTextAlign(map["textAlignHorizontal"] as String); 53 | var textAlignVertical = map["textAlignVertical"] as String; 54 | var fontFamily = map["fontFamily"] as String; 55 | var letterSpacing = map["letterSpacing"].toDouble(); 56 | var lineHeightPx = map["lineHeightPx"].toDouble(); 57 | var lineHeightPercent = map["letterSpacing"].toDouble(); 58 | var fontWeight = map["fontWeight"].toInt(); 59 | 60 | return new Code("ui.ParagraphStyle(" + 61 | "fontFamily: '$fontFamily'," + 62 | "textAlign: $textAlignHorizontal," + 63 | "fontSize: ${toFixedDouble(fontSize)}," + 64 | "fontWeight: FontWeight.w$fontWeight," + 65 | ")"); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/base/transform.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/tools/format.dart'; 3 | 4 | /** 5 | * A code generator that translates Figma transform matrix nodes 6 | * into Flutter [Float64List] equivalents. 7 | */ 8 | class TransformGenerator { 9 | Code generate(dynamic map) { 10 | var row0 = map[0]; 11 | var row1 = map[1]; 12 | 13 | var a = row0[0].toDouble(); 14 | var b = row0[1].toDouble(); 15 | var d = row1[0].toDouble(); 16 | var e = row1[1].toDouble(); 17 | 18 | var values = [ 19 | toFixedDouble(a), 20 | toFixedDouble(d), 21 | "0.0", 22 | "0.0", 23 | toFixedDouble(b), 24 | toFixedDouble(e), 25 | "0.0", 26 | "0.0", 27 | "0.0", 28 | "0.0", 29 | "1.0", 30 | "0.0", 31 | "frame.left", 32 | "frame.top", 33 | "0.0", 34 | "1.0", 35 | ]; 36 | 37 | return new Code("Float64List.fromList([" + values.join(", ") + "])"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/figma_to_flutter.dart: -------------------------------------------------------------------------------- 1 | export 'api.dart'; 2 | export 'file.dart'; -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/nodes/component.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/context.dart'; 3 | import 'package:figma_to_flutter/nodes/node.dart'; 4 | import 'package:figma_to_flutter/tools/format.dart'; 5 | 6 | /** 7 | * The root generator for initializing generated [CustomPainter] 8 | * paint method, generating all the [Widget], [CustomPainter] and data 9 | * classes 10 | */ 11 | class ComponentGenerator { 12 | final NodeGenerator _node; 13 | 14 | ComponentGenerator(this._node); 15 | 16 | List generate(String name, dynamic map, {bool withComments = false}) { 17 | var context = BuildContext(name, map, withComments: withComments); 18 | 19 | map["constraints"] = { 20 | "horizontal": "LEFT_RIGHT", 21 | "vertical": "TOP_BOTTOM", 22 | }; 23 | 24 | var relativeTransform = map["relativeTransform"]; 25 | var vx = -1 * relativeTransform[0][2].toDouble(); 26 | var vy = -1 * relativeTransform[1][2].toDouble(); 27 | 28 | context.addPaint([ 29 | "canvas.drawColor(Colors.transparent, BlendMode.screen);", 30 | "var frame = Offset.zero & size;", 31 | "canvas.translate(${toFixedDouble(vx)}, ${toFixedDouble(vy)});", 32 | ]); 33 | 34 | _node.generate(context, map, map, relativeTransform); 35 | 36 | return context.build(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/nodes/directive.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma_to_flutter/context.dart'; 2 | import 'package:figma_to_flutter/parsing/declaration.dart'; 3 | import 'package:figma_to_flutter/tools/format.dart' as format; 4 | 5 | class DirectiveGenerator { 6 | void _tap(BuildContext context, DirectiveItem item, dynamic map) { 7 | var propertyName = format.toVariableName(item.name); 8 | 9 | var cornerRadius = 0.0; 10 | 11 | var rectangleCornerRadii = map["rectangleCornerRadii"]; 12 | if (rectangleCornerRadii != null) { 13 | cornerRadius = rectangleCornerRadii[0].toDouble(); 14 | } 15 | 16 | var instance = 17 | "InkWell(onTap: $propertyName, borderRadius: BorderRadius.all(Radius.circular($cornerRadius)))"; 18 | 19 | context.addWidgetField("GestureTapCallback", propertyName, false); 20 | context.addChildWidget(instance, map); 21 | } 22 | 23 | void _widget(BuildContext context, DirectiveItem item, dynamic map) { 24 | var propertyName = format.toVariableName(item.name); 25 | 26 | var instance = "this.$propertyName"; 27 | 28 | context.addWidgetField("Widget", propertyName, false); 29 | context.addChildWidget(instance, map); 30 | } 31 | 32 | bool generate(BuildContext context, dynamic map) { 33 | var declaration = Declaration.parse(map["name"]) as DirectiveItem; 34 | 35 | if (declaration.directive == "tap" && map["type"] == "RECTANGLE") { 36 | _tap(context, declaration, map); 37 | return true; 38 | } 39 | 40 | if (declaration.directive == "widget") { 41 | _widget(context, declaration, map); 42 | return true; 43 | } 44 | 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/nodes/frame.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma_to_flutter/context.dart'; 2 | import '../base/color.dart'; 3 | import 'node.dart'; 4 | 5 | /** 6 | * A code generator that translates Figma frame nodes into 7 | * Flutter equivalents. 8 | */ 9 | class FrameGenerator { 10 | final ColorGenerator _color; 11 | final NodeGenerator _node; 12 | 13 | FrameGenerator(this._color, this._node); 14 | 15 | /** 16 | * Indicates whether this generator supports the given node (based on its type). 17 | */ 18 | bool isSupported(dynamic map) { 19 | const supported = [ 20 | 'FRAME', 21 | 'COMPONENT', 22 | 'INSTANCE', 23 | ]; 24 | return supported.contains(map["type"]); 25 | } 26 | 27 | void generate(BuildContext context, dynamic map) { 28 | // Draw background 29 | var color = _color.generate(map["backgroundColor"]); 30 | var paint = "(Paint()..color = $color)"; 31 | context.addPaint(["canvas.drawRect(Offset.zero & frame.size, $paint);"]); 32 | 33 | // Draw children 34 | map["children"].forEach((child) { 35 | this._node.generate(context, child, map, child["relativeTransform"]); 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/nodes/group.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:figma_to_flutter/context.dart'; 3 | import 'node.dart'; 4 | 5 | /** 6 | * A code generator that translates Figma group nodes into 7 | * Flutter equivalents. 8 | * 9 | * Group nodes doesn't apply a transform to canvas (like 10 | * frames), but combine its relative transform with each 11 | * child one and adds children to its parent. 12 | * 13 | * TODO Add center relative positionning for group children 14 | * 15 | */ 16 | class GroupGenerator { 17 | final NodeGenerator _node; 18 | 19 | GroupGenerator(this._node); 20 | 21 | dynamic _normalizeTransform(dynamic transform1, dynamic transform2) { 22 | var cos1 = transform1[0][0].toDouble(); 23 | var angle1 = acos(cos1); 24 | var x1 = transform1[0][2]; 25 | var y1 = transform1[1][2]; 26 | 27 | var cos2 = transform2[0][0].toDouble(); 28 | var sin2 = transform2[1][0].toDouble(); 29 | var angle2 = acos(cos2); 30 | var x2 = transform2[0][2]; 31 | var y2 = transform2[1][2]; 32 | 33 | var newAngle = angle1 + angle2; 34 | var newCos = cos(newAngle); 35 | var newSin = sin(newAngle); 36 | var newX = x2 + (x1 * cos2 - y1 * sin2); 37 | var newY = y2 + (x1 * sin2 + y1 * cos2); 38 | 39 | return [ 40 | [newCos, -newSin, newX], 41 | [newSin, newCos, newY], 42 | ]; 43 | } 44 | 45 | /** 46 | * Indicates whether this generator supports the given node (based on its type). 47 | */ 48 | bool isSupported(dynamic map) { 49 | const supported = ['GROUP']; 50 | return supported.contains(map["type"]); 51 | } 52 | 53 | void generate( 54 | BuildContext context, dynamic map, dynamic parent, dynamic transform) { 55 | map["children"].forEach((child) { 56 | var normalized = 57 | _normalizeTransform(child["relativeTransform"], transform); 58 | this._node.generate(context, child, parent, normalized); 59 | }); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/parsing/declaration.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents a custom component declaration (based on its name). 3 | * 4 | * Use [parse] method to get one of the available declaration types : 5 | * 6 | * * [StaticItem] : a typical component declaration 7 | * * [DynamicItem] : a dynamic component that can be updated by code. 8 | * * [DirectiveItem] : a custom directive that implies specific behaviours 9 | */ 10 | abstract class Declaration { 11 | String get name; 12 | 13 | static Declaration parse(String value) { 14 | if (value == null) return StaticItem(null); 15 | 16 | // Dynamic 17 | if (value.startsWith("\$")) { 18 | return DynamicItem(value.substring(1)); 19 | } 20 | 21 | // Directive 22 | if (value.startsWith("#")) { 23 | value = value.substring(1); 24 | var i = value.indexOf("("); 25 | var directive = value.substring(0, i); 26 | var child = Declaration.parse(value.substring(i + 1, value.length - 1)); 27 | return DirectiveItem(directive, child); 28 | } 29 | 30 | return StaticItem(value); 31 | } 32 | } 33 | 34 | class StaticItem extends Declaration { 35 | final String _name; 36 | StaticItem(this._name); 37 | 38 | @override 39 | String get name => _name; 40 | } 41 | 42 | class DynamicItem extends Declaration { 43 | final String _name; 44 | DynamicItem(this._name); 45 | 46 | @override 47 | String get name => _name; 48 | } 49 | 50 | class DirectiveItem extends Declaration { 51 | final String directive; 52 | final Declaration item; 53 | DirectiveItem(this.directive, this.item); 54 | 55 | @override 56 | String get name => item.name; 57 | } 58 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/tools/code.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | 3 | /** 4 | * Generates hash code and == operator base on a comparison for all [properties]. 5 | * 6 | * The algorithm used for hashcode generation looks like : 7 | * 8 | * ```dart 9 | * int hashcode = 17; 10 | * hashcode = 37 * hashcode + (this.$x?.hashCode ?? 0); 11 | * hashcode = 37 * hashcode + (this.$y?.hashCode ?? 0); 12 | * //... 13 | * ``` 14 | */ 15 | void addEqualsAndHashcode(ClassBuilder builder, List properties) { 16 | builder.methods.add(Method((b) => b 17 | ..name = "operator ==" 18 | ..annotations.add(CodeExpression(Code("override"))) 19 | ..lambda = true 20 | ..returns = refer("bool") 21 | ..body = Code("o is ${builder.name} && " + 22 | properties.map((x) => "$x == o.$x").join(" && ")) 23 | ..requiredParameters.add(Parameter((b) => b..name = "o")))); 24 | builder.methods.add(Method((b) => b 25 | ..name = "hashcode" 26 | ..annotations.add(CodeExpression(Code("override"))) 27 | ..returns = refer("int") 28 | ..type = MethodType.getter 29 | ..body = Block((b) { 30 | b.statements.add(Code("int result = 17;")); 31 | b.statements.addAll(properties.map( 32 | (x) => Code("result = 37 * result + (this.$x?.hashCode ?? 0);"))); 33 | b.statements.add(Code("return result;")); 34 | return b; 35 | }))); 36 | } 37 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/tools/code_catalog.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_builder/code_builder.dart'; 2 | import 'package:figma_to_flutter/tools/format.dart'; 3 | 4 | /** 5 | * A code repository that reference all identical code slices and give them a 6 | * unique identifier. 7 | */ 8 | class CodeCatalog { 9 | final String name, itemType, prefix; 10 | 11 | CodeCatalog(this.name, this.itemType) 12 | : this.prefix = toVariableName(itemType); 13 | 14 | Map _catalog = {}; 15 | 16 | /** 17 | * Gets the code to access the given code slice (if not already present in the catalog 18 | * it adds it to the catalog). 19 | */ 20 | Code get(String code) { 21 | var name = "${prefix}_${_catalog.length}"; 22 | 23 | if (_catalog.containsKey(code)) { 24 | name = _catalog[code]; 25 | } else { 26 | _catalog[code] = name; 27 | } 28 | 29 | return Code("${this.name}.instance.${name}"); 30 | } 31 | 32 | /** 33 | * Build a class that have a property for each stored code slice. 34 | * 35 | * Every property is initizialized in the main constructor. 36 | */ 37 | Class build() { 38 | var constructorBody = BlockBuilder(); 39 | var builder = ClassBuilder()..name = this.name; 40 | _catalog.forEach((k, v) { 41 | builder.fields.add(Field((b) => b 42 | ..name = v 43 | ..type = refer(this.itemType))); 44 | constructorBody.statements..add(Code("this.$v = $k;")); 45 | }); 46 | 47 | builder.fields.add(Field((b) => b 48 | ..name = "instance" 49 | ..static = true 50 | ..modifier = FieldModifier.final$ 51 | ..type = refer(builder.name) 52 | ..assignment = Code(builder.name + "()"))); 53 | 54 | builder.constructors 55 | .add(Constructor((b) => b..body = constructorBody.build())); 56 | 57 | return builder.build(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/tools/format.dart: -------------------------------------------------------------------------------- 1 | import 'package:recase/recase.dart'; 2 | 3 | /** 4 | * Converts the given value to a valid property name (camelCase). 5 | */ 6 | String toVariableName(String name) { 7 | name = _removeSpecialChars(name); 8 | return name[0].toLowerCase() + name.substring(1); 9 | } 10 | 11 | /** 12 | * Converts the given value to a valid class name (PascalCase). 13 | */ 14 | String toClassName(String name) { 15 | var rc = new ReCase(name); 16 | var className = rc.pascalCase; 17 | return _removeSpecialChars(className); 18 | } 19 | 20 | /** 21 | * Formats the given number to a unified string representation. 22 | */ 23 | String toFixedDouble(double value) { 24 | if (value == 0) return "0.0"; 25 | return value.toStringAsFixed(10); 26 | } 27 | 28 | /** 29 | * Removes every character that is not a digit or a number. 30 | */ 31 | String _removeSpecialChars(value) { 32 | return value.replaceAll(new RegExp("[^a-zA-Z0-9]"), "_"); 33 | } 34 | -------------------------------------------------------------------------------- /figma_to_flutter/src/lib/tools/positions.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | class Position { 4 | final double left; 5 | final double top; 6 | final double right; 7 | final double bottom; 8 | final double width; 9 | final double height; 10 | 11 | double get topFromBottom => height + bottom; 12 | 13 | double get leftFromRight => width + right; 14 | 15 | Position( 16 | this.left, this.top, this.right, this.bottom, this.width, this.height); 17 | 18 | Position.inside(Rectangle outer, Rectangle inner) 19 | : this.left = inner.left, 20 | this.right = (outer.width - inner.right), 21 | this.top = inner.top, 22 | this.bottom = (outer.height - inner.bottom), 23 | this.width = inner.width, 24 | this.height = inner.height; 25 | } 26 | -------------------------------------------------------------------------------- /figma_to_flutter/src/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: figma_to_flutter 2 | version: 0.1.0 3 | authors: 4 | - Aloïs Deniel 5 | description: a tool for generating Flutter widgets from Figma components. 6 | dependencies: 7 | path_parsing: 0.1.2 8 | http: 0.11.3+17 9 | vector_math: 2.0.8 10 | yaml: 2.1.15 11 | recase: 1.0.0+1 12 | source_gen: 0.8.3 13 | code_builder: 3.1.1 -------------------------------------------------------------------------------- /figma_to_flutter/website/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | ## Build 4 | 5 | First, pub packages need to be restored, then `dart2js` is used to generate the javascript part of the website 6 | 7 | ```bash 8 | > dart2js --out=docs/main.js website/web/main.dart 9 | ``` -------------------------------------------------------------------------------- /figma_to_flutter/website/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: webapp 2 | description: A website for Figma to Flutter code generator. 3 | 4 | environment: 5 | sdk: '>=2.0.0-dev.67.0 <2.0.0' 6 | 7 | dependencies: 8 | js: any 9 | http_server: 0.9.7 10 | figma_to_flutter: 11 | path: ../src 12 | 13 | dev_dependencies: 14 | build_runner: ^0.9.0 15 | build_web_compilers: ^0.4.0 16 | -------------------------------------------------------------------------------- /flutter_figma/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /flutter_figma/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: e6b34c2b5c96bb95325269a29a84e83ed8909b5f 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /flutter_figma/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "example", 9 | "cwd": "example", 10 | "request": "launch", 11 | "program": "lib/main.dart", 12 | "type": "dart" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /flutter_figma/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.0.1-alpha.19] 2 | 3 | * Added cache modes for design files. 4 | * Added `replaceColor` helper extension to figma nodes. 5 | * Not painting hidden nodes/fills/strokes/effects. 6 | * Added text style package. 7 | * Added node override. 8 | * Rendering basic elements. 9 | -------------------------------------------------------------------------------- /flutter_figma/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aloïs Deniel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flutter_figma/README.md: -------------------------------------------------------------------------------- 1 | # figma 2 | 3 | A new Flutter package project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Dart 8 | [package](https://flutter.dev/developing-packages/), 9 | a library module containing code that can be shared easily across 10 | multiple Flutter or Dart projects. 11 | 12 | For help getting started with Flutter, view our 13 | [online documentation](https://flutter.dev/docs), which offers tutorials, 14 | samples, guidance on mobile development, and a full API reference. 15 | -------------------------------------------------------------------------------- /flutter_figma/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:pedantic/analysis_options.yaml 2 | 3 | analyzer: 4 | errors: 5 | missing_required_param: error 6 | missing_return: error -------------------------------------------------------------------------------- /flutter_figma/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /flutter_figma/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: e6b34c2b5c96bb95325269a29a84e83ed8909b5f 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /flutter_figma/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /flutter_figma/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /flutter_figma/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_figma/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /flutter_figma/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /flutter_figma/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /flutter_figma/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Flutter/.last_build_id: -------------------------------------------------------------------------------- 1 | 3159e66f4e3629cc8389c0c3c2d68fdf -------------------------------------------------------------------------------- /flutter_figma/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - shared_preferences (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | shared_preferences: 14 | :path: ".symlinks/plugins/shared_preferences/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 18 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 19 | 20 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 21 | 22 | COCOAPODS: 1.9.3 23 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aloisdeniel/figma-to-flutter/07b7a0e77d57e303b122b8aec6a7b07af8ed5328/flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /flutter_figma/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /flutter_figma/example/lib/.gitignore: -------------------------------------------------------------------------------- 1 | private.dart -------------------------------------------------------------------------------- /flutter_figma/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'pages/enter_keys.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | // This widget is the root of your application. 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Figma Demo', 15 | theme: ThemeData( 16 | primarySwatch: Colors.blue, 17 | visualDensity: VisualDensity.adaptivePlatformDensity, 18 | ), 19 | home: EnterKeysPage(), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /flutter_figma/lib/figma.dart: -------------------------------------------------------------------------------- 1 | export 'src/figma.dart'; 2 | export 'src/design/design.dart'; 3 | export 'src/design/storage.dart'; 4 | export 'src/helpers/api_extensions.dart'; 5 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/design/storage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:path_provider/path_provider.dart'; 5 | import 'package:path/path.dart' as path; 6 | 7 | abstract class FigmaDesignStorage { 8 | const FigmaDesignStorage(); 9 | Future exists(String fileId); 10 | Future> load(String fileId); 11 | Future save(String fileId, Map json); 12 | } 13 | 14 | class FileFigmaDesignStorage extends FigmaDesignStorage { 15 | final String directoryName; 16 | 17 | const FileFigmaDesignStorage({ 18 | this.directoryName = '.flutter_figma', 19 | }); 20 | 21 | Future _cacheFile(String fileId) async { 22 | final appDocDir = await getApplicationDocumentsDirectory(); 23 | final directory = Directory(path.join(appDocDir.path, directoryName)); 24 | return File(path.join(directory.path, fileId)); 25 | } 26 | 27 | @override 28 | Future> load(String fileId) async { 29 | final localFile = await _cacheFile(fileId); 30 | 31 | if (await localFile.exists()) { 32 | final content = await localFile.readAsString(); 33 | return jsonDecode(content); 34 | } 35 | 36 | return null; 37 | } 38 | 39 | @override 40 | Future save(String fileId, Map json) async { 41 | if (json != null) { 42 | final localFile = await _cacheFile(fileId); 43 | 44 | final parent = Directory(path.dirname(localFile.path)); 45 | 46 | if (!await parent.exists()) { 47 | await parent.create(); 48 | } 49 | 50 | await localFile.writeAsString(jsonEncode(json)); 51 | } 52 | } 53 | 54 | @override 55 | Future exists(String fileId) async { 56 | final localFile = await _cacheFile(fileId); 57 | return await localFile.exists(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/figma.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma/figma.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class Figma extends InheritedWidget { 5 | final FigmaClient api; 6 | 7 | Figma({ 8 | Key key, 9 | @required Widget child, 10 | @required String token, 11 | }) : assert(token != null), 12 | api = FigmaClient(token), 13 | super( 14 | key: key, 15 | child: child, 16 | ); 17 | 18 | static Figma of(BuildContext context) { 19 | return context.dependOnInheritedWidgetOfExactType(); 20 | } 21 | 22 | @override 23 | bool updateShouldNotify(Figma oldWidget) { 24 | return api.accessToken != oldWidget.api.accessToken; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/blurred.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | import 'package:flutter_figma/src/helpers/api_extensions.dart'; 5 | import 'package:flutter_figma/src/rendering/decoration.dart'; 6 | 7 | class FigmaBlurred extends StatelessWidget { 8 | final Widget child; 9 | final List effects; 10 | final List cornerRadii; 11 | const FigmaBlurred({ 12 | Key key, 13 | @required this.child, 14 | @required this.cornerRadii, 15 | @required this.effects, 16 | }) : assert(effects != null), 17 | super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | var result = child; 22 | 23 | for (var effect in effects) { 24 | result = ClipRRect( 25 | borderRadius: cornerRadii.toBorderRadius(), 26 | child: BackdropFilter( 27 | filter: ImageFilter.blur( 28 | sigmaX: effect.radius, 29 | sigmaY: effect.radius, 30 | ), 31 | child: result, 32 | ), 33 | ); 34 | } 35 | 36 | return result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/layouts/constrained_layout.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/rendering.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_figma/src/rendering/layouts/constrained_layout.dart'; 4 | import 'package:figma/figma.dart' as figma; 5 | 6 | class FigmaConstrainedLayout extends MultiChildRenderObjectWidget { 7 | final Size designSize; 8 | FigmaConstrainedLayout({ 9 | Key key, 10 | @required this.designSize, 11 | List children = const [], 12 | }) : super( 13 | key: key, 14 | children: children, 15 | ); 16 | 17 | @override 18 | RenderObject createRenderObject(BuildContext context) { 19 | return RenderFigmaConstrainedLayout( 20 | designSize: designSize, 21 | ); 22 | } 23 | 24 | @override 25 | void updateRenderObject(BuildContext context, 26 | covariant RenderFigmaConstrainedLayout renderObject) { 27 | renderObject..designSize = designSize; 28 | } 29 | } 30 | 31 | class FigmaConstrainedData extends ContainerBoxParentData { 32 | figma.LayoutConstraint constraints; 33 | Size designSize; 34 | Offset designPosition; 35 | @override 36 | String toString() => 37 | '${super.toString()}; designSize=$designSize; designPosition=$designPosition; constraints=$constraints'; 38 | } 39 | 40 | class FigmaConstrained extends ParentDataWidget { 41 | const FigmaConstrained({ 42 | Key key, 43 | @required this.constraints, 44 | @required this.designSize, 45 | @required this.designPosition, 46 | @required Widget child, 47 | }) : super(key: key, child: child); 48 | 49 | final figma.LayoutConstraint constraints; 50 | final Size designSize; 51 | final Offset designPosition; 52 | 53 | @override 54 | void applyParentData(RenderObject renderObject) { 55 | assert(renderObject.parentData is FigmaConstrainedData); 56 | final parentData = renderObject.parentData as FigmaConstrainedData; 57 | var needsLayout = false; 58 | 59 | if (parentData.constraints != constraints) { 60 | parentData.constraints = constraints; 61 | needsLayout = true; 62 | } 63 | 64 | if (parentData.designSize != designSize) { 65 | parentData.designSize = designSize; 66 | needsLayout = true; 67 | } 68 | 69 | if (parentData.designPosition != designPosition) { 70 | parentData.designPosition = designPosition; 71 | needsLayout = true; 72 | } 73 | 74 | if (needsLayout) { 75 | final targetParent = renderObject.parent; 76 | if (targetParent is RenderObject) targetParent.markNeedsLayout(); 77 | } 78 | } 79 | 80 | @override 81 | Type get debugTypicalAncestorWidgetClass => FigmaConstrainedLayout; 82 | } 83 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/layouts/rotated.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_figma/src/rendering/layouts/rotated.dart'; 3 | 4 | class FigmaRotated extends SingleChildRenderObjectWidget { 5 | const FigmaRotated({ 6 | Key key, 7 | @required this.transform, 8 | Widget child, 9 | }) : assert(transform != null), 10 | super(key: key, child: child); 11 | 12 | final List> transform; 13 | 14 | @override 15 | RenderFigmaRotated createRenderObject(BuildContext context) => 16 | RenderFigmaRotated(transform: transform); 17 | 18 | @override 19 | void updateRenderObject( 20 | BuildContext context, RenderFigmaRotated renderObject) { 21 | renderObject.transform = transform; 22 | } 23 | } 24 | 25 | RotatedBox e; 26 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/mask.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_figma/src/rendering/decoration.dart'; 3 | import '../helpers/api_extensions.dart'; 4 | 5 | class FigmaMask extends StatelessWidget { 6 | final FigmaShape shape; 7 | final Widget child; 8 | const FigmaMask({ 9 | Key key, 10 | @required this.shape, 11 | @required this.child, 12 | }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final shape = this.shape; 17 | if (shape == null) { 18 | return child; 19 | } 20 | if (shape is FigmaRectangleShape) { 21 | final rectangleCornerRadii = shape.rectangleCornerRadii.toBorderRadius(); 22 | return ClipRRect( 23 | borderRadius: rectangleCornerRadii, 24 | child: child, 25 | ); 26 | } 27 | 28 | if (shape is FigmaPathShape) { 29 | return ClipPath( 30 | clipper: _Clipper(shape), 31 | child: child, 32 | ); 33 | } 34 | 35 | return child; 36 | } 37 | } 38 | 39 | class _Clipper extends CustomClipper { 40 | final FigmaPathShape shape; 41 | 42 | const _Clipper(this.shape); 43 | 44 | @override 45 | Path getClip(Size size) { 46 | final clipPath = Path(); 47 | for (var geometry in shape.fillGeometry) { 48 | final bounds = geometry.getBounds(); 49 | final transform = (Matrix4.identity() 50 | ..scale( 51 | size.width / (bounds.left + bounds.width), 52 | size.height / (bounds.top + bounds.height), 53 | )); 54 | clipPath.addPath(geometry.transform(transform.storage), Offset.zero); 55 | } 56 | return clipPath; 57 | } 58 | 59 | @override 60 | bool shouldReclip(_Clipper oldClipper) { 61 | return oldClipper.shape != shape; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/rectangle.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma/figma.dart' as figma; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_figma/src/rendering/decoration.dart'; 4 | import 'package:flutter_figma/src/helpers/api_extensions.dart'; 5 | import 'package:flutter_figma/src/widgets/blurred.dart'; 6 | import 'package:flutter_figma/src/widgets/layouts/rotated.dart'; 7 | 8 | class FigmaRectangle extends StatelessWidget { 9 | final double opacity; 10 | final Decoration decoration; 11 | final List blurEffects; 12 | final List> relativeTransform; 13 | final List rectangleCornerRadii; 14 | 15 | const FigmaRectangle({ 16 | Key key, 17 | @required this.opacity, 18 | @required this.decoration, 19 | @required this.blurEffects, 20 | @required this.relativeTransform, 21 | @required this.rectangleCornerRadii, 22 | }) : super( 23 | key: key, 24 | ); 25 | 26 | factory FigmaRectangle.api(figma.Rectangle node, {String package}) { 27 | final effects = node.effects 28 | .where((x) => x.visible ?? true) 29 | .map((x) => FigmaEffect.api(x)) 30 | .toList(); 31 | Decoration decoration; 32 | if (node.fills.isNotEmpty || 33 | node.strokes.isNotEmpty || 34 | node.effects.isNotEmpty) { 35 | decoration = FigmaPaintDecoration( 36 | strokeWeight: node.strokeWeight, 37 | shape: FigmaRectangleShape( 38 | rectangleCornerRadii: 39 | node.rectangleCornerRadii ?? const [0, 0, 0, 0], 40 | ), 41 | fills: node.fills 42 | .where((x) => x.visible ?? true) 43 | .map((x) => FigmaPaint.api(x)) 44 | .toList(), 45 | strokes: node.strokes 46 | .where((x) => x.visible ?? true) 47 | .map((x) => FigmaPaint.api(x)) 48 | .toList(), 49 | effects: effects, 50 | ); 51 | } 52 | 53 | return FigmaRectangle( 54 | key: node.id != null ? Key(node.id) : null, 55 | opacity: node.opacity ?? 1.0, 56 | blurEffects: effects.whereType().toList(), 57 | decoration: decoration, 58 | relativeTransform: node.relativeTransform, 59 | rectangleCornerRadii: node.rectangleCornerRadii, 60 | ); 61 | } 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | Widget child = SizedBox(); 66 | 67 | if (decoration != null) { 68 | child = DecoratedBox( 69 | decoration: decoration, 70 | ); 71 | } 72 | 73 | if (blurEffects.isNotEmpty) { 74 | child = FigmaBlurred( 75 | cornerRadii: rectangleCornerRadii, 76 | effects: blurEffects, 77 | child: child, 78 | ); 79 | } 80 | 81 | if (opacity < 1) { 82 | child = Opacity( 83 | opacity: opacity, 84 | child: child, 85 | ); 86 | } 87 | 88 | if (relativeTransform != null && relativeTransform.isRotated) { 89 | child = FigmaRotated( 90 | transform: relativeTransform, 91 | child: child, 92 | ); 93 | } 94 | 95 | return child; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/vector.dart: -------------------------------------------------------------------------------- 1 | import 'package:figma/figma.dart' as figma; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_figma/src/rendering/decoration.dart'; 4 | import 'package:path_drawing/path_drawing.dart'; 5 | import 'package:flutter_figma/src/helpers/api_extensions.dart'; 6 | 7 | import 'layouts/rotated.dart'; 8 | 9 | class FigmaVector extends StatelessWidget { 10 | final double opacity; 11 | final Decoration decoration; 12 | final List> relativeTransform; 13 | const FigmaVector({ 14 | Key key, 15 | @required this.opacity, 16 | @required this.decoration, 17 | @required this.relativeTransform, 18 | }) : super( 19 | key: key, 20 | ); 21 | 22 | factory FigmaVector.api(figma.Vector node, {String package}) { 23 | Decoration decoration; 24 | if ((node.fillGeometry != null || node.strokeGeometry != null) && 25 | (node.fills.isNotEmpty || 26 | node.strokes.isNotEmpty || 27 | node.effects.isNotEmpty)) { 28 | decoration = FigmaPaintDecoration( 29 | strokeWeight: node.strokeWeight, 30 | fills: node.fills 31 | .where((x) => x.visible ?? true) 32 | .map((x) => FigmaPaint.api(x)) 33 | .toList(), 34 | strokes: node.strokes 35 | .where((x) => x.visible ?? true) 36 | .map((x) => FigmaPaint.api(x)) 37 | .toList(), 38 | effects: node.effects 39 | .where((x) => x.visible ?? true) 40 | .map((x) => FigmaEffect.api(x)) 41 | .toList(), 42 | shape: FigmaPathShape( 43 | fillGeometry: (node.fillGeometry ?? node.strokeGeometry) 44 | .map( 45 | (x) => parseSvgPathData(x['path']), 46 | ) 47 | .toList(), 48 | ), 49 | ); 50 | } 51 | 52 | return FigmaVector( 53 | key: node.id != null ? Key(node.id) : null, 54 | decoration: decoration, 55 | opacity: node.opacity ?? 1.0, 56 | relativeTransform: node.relativeTransform, 57 | ); 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | Widget child = SizedBox(); 63 | 64 | if (decoration != null) { 65 | child = DecoratedBox( 66 | decoration: decoration, 67 | ); 68 | } 69 | 70 | if (opacity < 1) { 71 | child = Opacity( 72 | opacity: opacity, 73 | child: child, 74 | ); 75 | } 76 | 77 | if (relativeTransform != null && relativeTransform.isRotated) { 78 | child = FigmaRotated( 79 | transform: relativeTransform, 80 | child: child, 81 | ); 82 | } 83 | 84 | return child; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /flutter_figma/lib/src/widgets/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'frame.dart'; 2 | export 'rectangle.dart'; 3 | export 'text.dart'; 4 | export 'vector.dart'; 5 | export 'layouts/auto_layout.dart'; 6 | export 'layouts/constrained_layout.dart'; 7 | export 'layouts/rotated.dart'; 8 | -------------------------------------------------------------------------------- /flutter_figma/lib/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'src/widgets/widgets.dart'; 2 | -------------------------------------------------------------------------------- /flutter_figma/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_figma 2 | description: Rendering Figma components as Flutter widgets. 3 | version: 0.0.1-alpha.19 4 | homepage: https://github.com/aloisdeniel/figma-to-flutter/tree/master/figma_theme_generator 5 | 6 | environment: 7 | sdk: ">=2.7.0 <3.0.0" 8 | 9 | dependencies: 10 | path: ^1.8.0-nullsafety.1 11 | path_provider: ^1.6.18 12 | collection: ^1.15.0-nullsafety.3 13 | figma: ^2.0.3 14 | path_drawing: ^0.4.1 15 | flutter: 16 | sdk: flutter 17 | 18 | dev_dependencies: 19 | pedantic: 20 | flutter_test: 21 | sdk: flutter 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://dart.dev/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # To add assets to your package, add an assets section, like this: 30 | # assets: 31 | # - images/a_dot_burr.jpeg 32 | # - images/a_dot_ham.jpeg 33 | # 34 | # For details regarding assets in packages, see 35 | # https://flutter.dev/assets-and-images/#from-packages 36 | # 37 | # An image asset can refer to one or more resolution-specific "variants", see 38 | # https://flutter.dev/assets-and-images/#resolution-aware. 39 | 40 | # To add custom fonts to your package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.dev/custom-fonts/#from-packages 59 | --------------------------------------------------------------------------------