a small script that converts adobe illustrator paths to dart for use in flutter

Overview

cpainterhelper

A simple script that lets you convert adobe illustrator paths to code compatible with flutter's CustomPainter

How to use it

First set up an illustrator document. It is very important that you keep in mind the aspect ratio since the script will make every measure proportional.

Creation Dialog

Then draw your desired shape with the pen tool. The tool now supports paths, compound paths, and even radial and linear gradients!

Here are some examples of admissible paths:

Example 1, artwork by Giulia Cregut Example 2, transparency and gradients are supported Example 3, compound paths are also now supported

Now, select File > Scripts > Other Script... or press ctrl + F12 on your keyboard. Navigate to the script and select it.

Script menu

The script will create a new text object containing the result. Each path will be converted to Lines, Quadratic and/ or Cubic Beziers and will automatically be assigned a Paint for its fill and one for its stroke, if it has one.

Output

The script iterates every path in the current active document.

The output should look something like this:

Rect rect = Offset.zero & size; 
//Number 0
Path path0 = Path(); 
/* ... */
canvas.drawPath(path0, spaint0); 

//Number 1
//...
//Number 2
//...
//Number 3
//...

You can copy the result inside the paint method of your CustomPainter. Add these to lines on top to make the code work:

final height = size.height;
final width = size.width;

Here are the results from the previous examples rendered in flutter

Example 1 Example 2 Example 3

You might also like...

A collection of sample apps that use Stream

A collection of sample apps that use Stream

Flutter samples Quick Links Register to get an API key for Stream Chat Flutter Chat Tutorial Chat UI Kit Flutter SDK Repo What is Stream? Stream allow

Dec 21, 2022

3 different demos showing how to use bloc concurrency, before and after the Bloc 7.2.0 update.

3 different demos showing how to use bloc concurrency, before and after the Bloc 7.2.0 update.

Bloc Concurrency Demos 3 different scenarios demonstrating how to structure blocs to take advantage of concurrent event processing in Bloc 7.2/8.0. Ea

Nov 30, 2022

Use dynamic and beautiful card view pagers (horizontal direction) to help you create great apps.

Use dynamic and beautiful card view pagers (horizontal direction) to help you create great apps.

Use dynamic and beautiful card view pagers (horizontal direction) to help you create great apps. Preview Mobile Vertical Card Pager Web Web Link Insta

Dec 9, 2022

A mobile travel app is a software application that has been developed specifically for use on smaller devices

A mobile travel app is a software application that has been developed specifically for use on smaller devices

A mobile travel app is a software application that has been developed specifically for use on smaller devices, such as smartphones and tablets, and can be used by business travellers to book and manage their travel whilst on the move

Apr 27, 2022

This is a simple quiz app I created for specific use in my church.

flip_quiz_questions A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you star

Dec 27, 2021

Flutte movies app, can be use as a starting point for your next project

Flutte movies app, can be use as a starting point for your next project

Flutte movies app, can be use as a starting point for your next project

Feb 28, 2022

A flutter app for beginners when using flutter and Dart packages to speed up development

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

Nov 15, 2021

The objective is to create a simple app using Dart/Flutter, for make a REST API integration with Flutter, using free JSON API

The objective is to create a simple app using Dart/Flutter, for make a REST API integration with Flutter, using free JSON API

ListView Builder App The objective is to create a simple app using Dart/Flutter, for make a REST API integration with Flutter, using free JSON API: ht

Dec 7, 2022

Cryptocurrency App with MVP Design Pattern to track all the coins data in realtime for android & iOS . Written in dart using Flutter SDK.

Cryptocurrency App with MVP Design Pattern to track all the coins data in realtime for android & iOS . Written in dart using Flutter SDK.

Flutter CryptoCurrency App (MVP) Cryptocurrency App with MVP design pattern to track all the coins data in realtime for android & iOS . Written in dar

Dec 30, 2022
Owner
null
Mongolian vertical script widgets for Flutter apps

mongol This library is a collection of Flutter widgets for displaying traditional Mongolian vertical text. The primary widgets include: MongolText: ve

null 56 Dec 12, 2022
Shopping app for small company. note : the name will change

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

Sadra Galavani 0 Jan 10, 2022
A simple Todo app designed to simply use GraphQL as backend and provide an easy to use UI/UX.

simple_todo_app A simple Todo app designed to simply use GraphQL as backend and provide an easy to use UI/UX. A breakdown of the project and explanati

Emir Halıcı 2 Oct 9, 2022
Examples showing how to use Rid in order to build Dart/Flutter apps integrated with Rust.

Examples showing how to use Rid in order to build Dart/Flutter apps integrated with Rust.

Thorsten Lorenz 205 Dec 24, 2022
A fully responsive BMI calculator app made using flutter and dart with beautiful minimalistic user interface design and easy to use .

BMI_Calculator_Flutter A fully responsive BMI calculator app made using flutter and dart with beautiful minimalistic user interface design and easy to

null 1 Oct 9, 2021
To do and accomplishment app built with Flutter and Dart. Made use of Provider

Todioapp A todo and accomplishment app built with Flutter Getting Started This project is a starting point for a Flutter application. A few resources

Atuoha Anthony 2 Dec 10, 2022
Shopping App developed using Flutter and Dart making use of Provider, Carousel Library, Google FireStore

Shopping App developed using Flutter and Dart making use of Provider, Carousel Library, Google FireStore. It's featuring standard modern shopping app UI

Atuoha Anthony 7 Jan 3, 2023
This is a Flutter app which shows how to use Dismissible Class

dismissible_calss A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you starte

Shehzaan Mansuri 2 Oct 25, 2021
11t is an iOS and Android app for connecting to Mastodon, written in Flutter. 11t lets you use any Mastodon instance.

README 11t is an iOS and Android app for connecting to Mastodon, written in Flutter. I connect to Mastodon on mastodon.social, but everyone can start

Jeroen Smeets 88 Dec 23, 2022
Use of Divider in Flutter (in our developed ID Card App)

Use_Of_Divider_In_IDCard Use of Divider in Flutter. Use of Divider in Flutter (in our developed ID Card App) Getting Started This project is a startin

Avinandan Bose 1 Mar 19, 2022