Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aloisdeniel/built_vector
Generate Flutter vector code from a subset of SVG files.
https://github.com/aloisdeniel/built_vector
dart flutter shape svg vector
Last synced: 4 months ago
JSON representation
Generate Flutter vector code from a subset of SVG files.
- Host: GitHub
- URL: https://github.com/aloisdeniel/built_vector
- Owner: aloisdeniel
- License: mit
- Created: 2018-11-14T13:06:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-03T11:34:08.000Z (over 2 years ago)
- Last Synced: 2024-10-12T22:43:35.681Z (4 months ago)
- Topics: dart, flutter, shape, svg, vector
- Language: Dart
- Homepage:
- Size: 13.7 KB
- Stars: 35
- Watchers: 3
- Forks: 6
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# built_vector
Generates Flutter vector code from minimalist SVG-like files.
## Usage
```sh
> pub global activate built_vector
> pub global run built_vector -i -o
```A class named accordingly to your assets node's name, containing a `void Paint(Canvas canvas, Size size, {Color fill})` function for each vector node.
You can then use them with a custom painter, like with the [sample/lib/vectors.dart](sample/lib/vectors.dart) `Vector` widget.
## File format
### Assets
An asset catalog is a collection of assets (`vector` only at the moment).
```xml
```
### Vector
A vector is a collection of filled shapes.
It has several properties :
* `name` **(required)** : the identifier of the vector asset
* `viewBox` **(required)** : a box (` `)that contains all the shapes.
* `fill` : a default fill brush for shapes```xml
```
### Shape
A shape is a set of instructions to build an area to fill with a brush. Currently it can be `rect`, `circle`, `path`.
It has several properties :
* `fill` : a default fill brush for shapes
* `rect` - `x`, `y`, `width`, `height` : position and size
* `circle` - `cx`, `cy`, `r` : center coordinates and radius
* `path` - `d` : SVG path data```xml
```
## Sample
To generate the sample, execute :
```sh
> pub global run built_vector -i sample/assets/icons.assets -o sample/lib/icons.g.dart
```The [sample/assets/icons.assets](sample/assets/icons.assets) file is generated as [sample/lib/icons.g.dart](sample/lib/icons.g.dart).