built_vector
Generates Flutter vector code from minimalist SVG-like files.
Usage
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 Vector
widget.
File format
Assets
An asset catalog is a collection of assets (vector
only at the moment).
Vector
A vector is a collection of filled shapes.
It has several properties :
name
(required) : the identifier of the vector assetviewBox
(required) : a box (<x> <y> <width> <height>
)that contains all the shapes.fill
: a default fill brush for shapes
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 shapesrect
-x
,y
,width
,height
: position and sizecircle
-cx
,cy
,r
: center coordinates and radiuspath
-d
: SVG path data
Sample
To generate the sample, execute :
The sample/assets/icons.assets file is generated as sample/lib/icons.g.dart.