Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    * Render primitives (the optimized layer)

    The family of elements whose names start with * are highly optimized render components : unlike ordinary elements (each one a separate Flutter widget), all * elements of one chain are drawn as a single object straight onto the canvas ( Canvas ). This gives minimal overhead — ideal for dashboards and charts , where redraw speed matters.

    When to use: dashboard cards/tiles, gradient backgrounds, vector graphics and charts. For the ordinary layout of screens use the widget elements ( Column / Row / Grid /…).

    How to draw graphics. The general way to draw anything is the low-level drawing primitives ( *Line / *Rect / *Circle / *Arc / *Polygon / *Points / *Path ) in the *Stack compositor, with effects ( *Clip / *Transform / *Opacity ) and the *Repeat iterator. The ready-made charts ( $Bars / $Sparkline / $Donut / $Ring ) are macros over these primitives (see “Drawing primitives” and “Charts as macros” ).

    Model: a linear chain of * elements is drawn as one object; a tree that branches ( *Stack / *Repeat ) or wraps a subtree in an effect ( *Clip / *Transform / *Opacity ) is also drawn whole in a single pass. Each layer either sets padding/size or draws into the shared box. The size comes from the innermost element that has a size ( *Text , primitives) — the others ( *Colored , *Gradient , *Padding ) wrap it. Primitives are adaptive : they draw into the size they are given; width / height can be fixed.

    Base components

    Element Type Description
    *Colored single-child A solid colour fill (+ radius rounding).
    *Gradient single-child A two-stop linear gradient ( from / to / angle / radius ).
    *Padding single-child Padding around the nested content.
    *Text leaf Text drawn directly with TextPainter .
    *Captions leaf Subtitles from cues on the film's clock: windows by the norms, entering and leaving within the margins, scrolling, word-by-word fill; the style is #style (TextStyle), a :# speaker:"A" block per speaker. Only inside *Scene .
    *Sprite leaf A project image in scene coordinates ( x / y / w / h , as for *Rect ): still, a sprite sheet ( grid:[columns, rows] + fps ) or a list of frames frames: ; the frame follows the layer's clock, flipX / flipY , filterQuality:none for pixel art.
    *Stack multi-child Compositor: lays children into one box (bottom to top).
    *State single-child A scope of reactive @ variables for nested * elements.

    *Colored

    *Colored color:0xFF36345E radius:12
      *Text "On dark" color:0xFFFFFFFF
    Parameter Type Default Description
    color color transparent Fill colour. Read at drawing time, so it can depend on the *Repeat iteration ( color:{pick(index, …)} ).
    radius double 0 Corner rounding.

    *Gradient

    *Gradient from:0xFF6D5EF6 to:0xFF9B8AFB angle:120 radius:16
      *Padding all:20
        *Text "Balance" color:0xFFFFFFFF
    Parameter Type Default Description
    from color transparent Start colour.
    to color transparent End colour.
    angle double 0 Angle in degrees: 0 = left→right, 90 = top→bottom.
    radius double 0 Corner rounding.

    Charts ( $Bars / $Sparkline / $Donut / $Ring ) are macros over the drawing primitives and *Repeat ; see the sections below.

    *Padding

    *Padding all:16
      *Text "Padded" color:0xFF333333
    Parameter Type Default Description
    all double — The same padding on all sides. If set, the other parameters are not read.
    horizontal double 0 Left and right padding. Read together with vertical when there is no all ; then the individual sides are not read.
    vertical double 0 Top and bottom padding.
    left double 0 Left padding (when there is neither all nor horizontal / vertical ).
    right double 0 Right padding.
    top double 0 Top padding.
    bottom double 0 Bottom padding.

    *Text

    Text through TextPainter , a leaf with no children. Without size the element measures itself by its content. With size it becomes a vector text primitive and behaves like *Rect : the point and the font size are read in surface coordinates and scale together with the artboard — a film is laid out for a fixed frame and drawn in a preview of any size. A Flutter Text moved into a scene does not solve this: it is laid out in the screen's logical pixels and does not see viewBox .

    *Text "Hello" color:0xFF333333
    *Scene size:[1080,1920] viewBox:[1080,1920] time:@t
      *Text "REEEL" x:540 y:820 size:96 weight:bold align:center color:0xFF0B0B10
    Parameter Type Default Description
    (positional) string — The text.
    color color black Text colour (with word fill — the colour of the part not yet spoken).
    size double — Font size in surface units (see viewBox ). Turns on vector mode.
    x double 0 Drawing point on X, in coordinate units. Not read without size .
    y double 0 The top edge of the text, in coordinate units.
    units string fractions Coordinate units: fractions 0..1 of the box, or px .
    viewBox [w,h] — A virtual w×h grid stretched over the box.
    maxWidth double — Wrap width in coordinate units; without it — a single line.
    align string — Which end of the text stands at x : left / center / right ; wrapped lines are aligned the same way.
    weight FontWeight — Weight: w100 .. w900 , normal , bold .
    fontFamily string — Family: from data/fonts/ or built in.
    strokeColor color — Outline colour; drawn OVER the fill, as with Text . Needs strokeWidth .
    strokeWidth double 0 Outline thickness, in size units.
    paintOrder string — stroke puts the outline UNDER the fill (CSS paint-order ): letters keep their weight, the outline shows only outside; the shadow then goes under the outline.
    shadowColor color — Colour of the shadow under the text — keeps white text readable on light video.
    shadowBlur double 0 Shadow blur radius, in size units.
    shadowOffset [dx, dy] — Shadow offset, in size units.
    spokenColor color — Colour of the part ALREADY spoken; color stays the colour of the rest. The spoken part grows in reading order — line by line, letter by letter within a word. Set through words: + now: or through sweep: .
    words list — When each word is spoken, in order: [[start, end], …] or [{"start": s, "end": e}, …] , on the same clock as now: . One pair per word (words split by spaces); after the end of the last pair the whole text is spoken.
    now double — The current moment on the words: clock — in a *Scene usually {t} .
    sweep double — What share of the text is spoken, 0…1 of its characters — a fill without word timings.
    z double — Drawing order in the nearest *Stack / *Scene / *Artboard (see `z` ).

    *Captions

    Subtitles from cues on the film's clock (only inside *Scene ). Line windows follow subtitle norms: a line appears 0.2 s before the voice, holds up to 0.5 s after, there are two frames between lines, short pauses are closed. A line that has room animates within its margins; back-to-back lines scroll up; words fill as they are spoken.

    JsonData src:"data/subtitles.jsonl" data:@subs
      *Scene id:ready duration:30s fps:30 size:[1080,1920] viewBox:[1080,1920] time:@t
        *Captions cues:$subs

    The style is a standard TextStyle in #style ; a :# block per speaker overrides the style and any layout or motion of that speaker's lines; #unspoken recolours the part not yet spoken.

    JsonData src:"data/subtitles.jsonl" data:@subs
      *Scene id:ready duration:30s fps:30 size:[1080,1920] viewBox:[1080,1920] time:@t
        *Captions cues:$subs cuts:[11.9, 23.3]
          #style fontWeight:w800 strokeColor:0xFF000000
          :# speaker:"A" x:320 align:left
            #style color:0xFFFFD166
          :# speaker:"B" join:push
            #style color:0xFF7FDBFF

    Data and time

    Parameter Type Default Description
    cues list — Entries {start, end, text, speaker?, words?, show?, hide?} in film seconds; show / hide set a single line's window by hand.
    now double scene clock The moment drawn, in film seconds; by default the scene clock (even inside a shifted *Layer ).
    cuts list — Edit cuts in film seconds: no line crosses a cut.
    leadIn double 0.2 How many seconds before the voice a line appears.
    leadOut double 0.5 How many seconds a line holds after the voice.
    minGap double two scene frames Seconds between neighbouring lines.
    mergeGap double 0.5 A pause shorter than this is closed: the line holds until the next one.
    minDuration double 0.8 Minimum seconds per line.

    Style

    Parameter Type Default Description
    #style TextStyle — Style of every line: fontSize , fontWeight , color , fontFamily , letterSpacing , height , strokeColor , strokeWidth , #shadows — lengths in scene units.
    #unspoken TextStyle line style Style of the part not yet spoken; by default the line style with the colour at unspokenOpacity .
    fill string words words fills words as they are spoken; none draws each line whole.
    unspokenOpacity double 0.65 How visible the unspoken part is, 0…1 of the line colour.
    paintOrder string stroke stroke puts the outline under the fill (the subtitle look); normal — over it.

    Layout

    Parameter Type Default Description
    units string fractions Coordinate units: fractions 0..1 of the box, or px .
    viewBox [w,h] — A virtual w×h grid stretched over the box.
    x double middle of the frame Where the block stands horizontally, in scene units.
    y double 72 % of a vertical frame, 90 % of a horizontal one Where the block stands vertically.
    anchor string top (vertical frame) / bottom (horizontal) Which edge of the block stands at y .
    align string center Which end of the block stands at x and how wrapped lines are aligned: left / center / right .
    maxWidth double 87 % of a vertical frame's width, 80 % of a horizontal one Wrap width.
    lineGap double 0.3 × font size Gap between the old and the new line while scrolling.
    rotate double — Block tilt, degrees.
    scale double 1 Block scale (1 — as laid out).

    Motion

    Parameter Type Default Description
    enter string rise How a line that has room appears: rise / fade / pop / none .
    exit string lift How it leaves: lift / fade / none .
    join string auto How a line replaces the previous one back to back: auto (separate animations when both margins fit them, otherwise scrolling), rollup , push , fade , cut .
    enterDuration double — Seconds of enter , no more than the margin before the voice.
    exitDuration double — Seconds of exit , no more than the margin after the voice.
    joinDuration double 0.4 Seconds of scrolling, push or cross-fade (ease-in-out).
    rise double — How far a line rises when appearing, in scene units.
    lift double — How far it rises when leaving.
    push double — How far push moves the lines.
    fadeTop double top of the lines at rest minus fadeLength Where the subtitles fully disappear, in scene units: nothing is drawn above it — a line leaving upwards dissolves before it reaches the picture.
    fadeLength double 0.8 × font size Length of the dissolve under fadeTop ; 0 — a hard cut.

    *Sprite

    A project image in the scene's own coordinates — still, or a sprite sheet played on the film's clock.

    *Scene duration:6s fps:30 size:[1080,1920] viewBox:[1080,1920] time:@t
      *Sprite src:"data/images/city.png" x:0 y:0 w:1080 h:1920
      *Sprite src:"data/images/cat_walk.png" grid:[8,1] fps:12 x:120 y:900 w:96 h:96 filterQuality:none
      *Sprite frames:["data/images/heron_1.png", "data/images/heron_2.png"] fps:4 x:600 y:1100 w:80 h:120

    Placed like *Rect : x / y / w / h in surface units — frame pixels under viewBox , fractions of the box without it (an Image moved into a scene is laid out in the screen's logical pixels and does not see viewBox ). The frame is a function of the clock and nothing else: fps steps through the grid cells (rows left to right, top to bottom) or through the frames files and starts over when the surrounding layer starts — so the frame on screen and the frame in the exported film are one and the same. Without w and h the image fills the surface; with one of them the other follows the frame's proportions. For pixel art — filterQuality:none and a whole-number scale (a 16 px cell to 48, not 50).

    Parameter Type Default Description
    src string — An image from the project root ( data/images/cat.png ), or a sprite sheet when grid is set.
    frames list — Images in turn instead of a sheet: ["a.png", "b.png"] .
    grid [columns, rows] — The sheet's cells.
    count double — How many grid cells are frames, when the last row is incomplete.
    fps double 0 Frames per second; 0 holds the first frame.
    frame double — Which frame to show, from 0 — by an expression or a *Track value; fps is then not used.
    loop bool true Start over after the last frame; false holds the last one.
    x double — Left edge.
    y double — Top edge.
    w double — Width; without it — from h and the frame's proportions.
    h double — Height; without it — from w and the frame's proportions.
    fit string contain How the frame fills w × h : contain (the whole frame without distortion), cover , fill .
    flipX bool false Mirror left to right — the character walks the other way.
    flipY bool false Mirror top to bottom.
    filterQuality string medium none for pixel art (no smoothing), low , medium , high .
    opacity double 1 Opacity 0…1 .
    units string fractions Coordinate units: fractions 0..1 of the box, or px .
    viewBox [w,h] — A virtual w×h grid stretched over the box.
    z double — Drawing order (see `z` ).

    Drawing primitives

    The low-level * primitives draw geometry straight onto the Canvas . From them (plus *Repeat ) you assemble any chart — the $Bars / $Donut /… charts are macros over the same mechanics.

    Coordinate space. By default coordinates are fractions 0..1 of the box (regardless of size): cx:0.5 cy:0.5 is the centre, r:0.42 is 42% of the smaller side. It can be switched:

    • units:px — absolute pixels;
    • viewBox:[w,h] — a virtual SVG grid w×h , stretched over the box.

    The radius ( r of *Circle / *Arc ) is a fraction of the smaller side; w / h scale with width/height.

    *Line x1:0.1 y1:0.85 x2:0.9 y2:0.2 color:0xFFF9C74F strokeWidth:4 cap:round
    *Rect x:0.15 y:0.15 w:0.7 h:0.7 radius:10 fill:0xFF6C5CE7
    *Circle cx:0.5 cy:0.5 r:0.38 fill:0x2200B894 color:0xFF00B894 strokeWidth:3
    *Arc cx:0.5 cy:0.5 r:0.4 startAngle:-90 value:0.68 strokeWidth:10 cap:round color:0xFF6C5CE7
    *Polygon points:[[0.5,0.12],[0.9,0.88],[0.1,0.88]] fill:0xFFE17055
    *Points values:[30,42,38,55,48,63,58,70,60] mode:line color:0xFF22C55E strokeWidth:2 cap:round join:round
    *Path d:"M0.05,0.9 L0.3,0.4 L0.5,0.65 L0.72,0.2 L0.95,0.5" color:0xFF9B8AFB strokeWidth:3

    Common drawing parameters

    Accepted by all seven primitives ( *Line / *Rect / *Circle / *Arc / *Polygon / *Points / *Path ) — each has the same set:

    Parameter Type Default Description
    color color — A friendly alias: for filled shapes ( *Rect / *Circle / *Polygon / *Arc sector) — the fill; for line shapes ( *Line / *Points / *Path / *Arc ring) — the stroke.
    fill color — Fill colour ( 0xAARRGGBB or #RRGGBB ).
    stroke color — Stroke (outline) colour.
    strokeWidth double 0 Stroke thickness; >0 turns on the stroke pass.
    cap StrokeCap butt Line end: butt | round | square .
    join StrokeJoin miter Segment join: miter | round | bevel .
    gradientFrom color — Start colour of a linear fill gradient (paired with gradientTo ).
    gradientTo color — End colour of the gradient.
    gradientAngle double 0 Gradient direction in degrees.
    blur double 0 Soft edge / glow: the MaskFilter.blur radius.
    blendMode BlendMode srcOver This primitive's blend mode — any Dart BlendMode name.
    antiAlias bool true Whether to smooth the edges.
    draw double 1 What share of the stroke is drawn, 0..1 from the start of the outline ( 1 — all of it). Does not affect the fill; see below .
    units string fractions Coordinate units: by default fractions 0..1 of the box, px — absolute pixels.
    viewBox [w,h] — A virtual SVG grid w×h , stretched over the box.
    width double -1 Fix the drawing width in px ( <=0 — adaptive, fills the box).
    height double -1 Fix the drawing height in px ( <=0 — adaptive).
    z double — Drawing order inside the nearest *Stack , *Scene , *Artboard or a group of several children: larger is closer and drawn later; without z it counts as 0; with equal keys — document order. Read every frame — on an isometric street you write the “feet”: z:{y + h} . Inside *Layer / *Track /effects it is the key of the whole branch.

    A shape draws a fill if fill /a gradient is set, and a stroke if strokeWidth>0 (or stroke is set). Both passes can apply at once.

    *Line

    A straight line between two points. Stroke only.

    *Line x1:0 y1:1 x2:1 y2:0 color:0xFF6C5CE7 strokeWidth:2 cap:round
    Parameter Type Default Description
    x1 double 0 Start, X.
    y1 double 0 Start, Y.
    x2 double 1 End, X.
    y2 double 1 End, Y.

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Rect

    A rectangle, optionally rounded. Fill and/or stroke.

    *Rect x:0.1 y:0.1 w:0.8 h:0.8 radius:8 fill:0xFF6C5CE7
    Parameter Type Default Description
    x double 0 Left edge.
    y double 0 Top edge.
    w double 1 Width.
    h double 1 Height.
    radius double 0 Rounding radius in px.

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Circle

    A circle. Fill and/or stroke.

    *Circle cx:0.5 cy:0.5 r:0.4 fill:0x2200B894 color:0xFF00B894 strokeWidth:3
    Parameter Type Default Description
    cx double 0.5 Centre, X (a fraction of the box by default).
    cy double 0.5 Centre, Y.
    r double 0.5 Radius — a fraction of the smaller side.

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Arc

    An arc, a ring segment or a sector. strokeWidth>0 — a ring (stroke), otherwise a filled sector.

    *Arc cx:0.5 cy:0.5 r:0.45 startAngle:-90 value:0.72 strokeWidth:12 cap:round color:0xFF6C5CE7
    Parameter Type Default Description
    cx double 0.5 Centre, X.
    cy double 0.5 Centre, Y.
    r double 0.5 Radius — a fraction of the smaller side.
    startAngle double -90 Where the arc starts, degrees ( -90 — the top, 12 o'clock).
    value number — Shorthand for a proportional sweep : value·360° ( 0..1 ).
    sweep double 0 Arc extent in degrees (not read if value is set).
    useCenter bool false Whether to close the arc through the centre (a “pie” sector).

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Polygon

    A polygon from a list of vertices. Fill and/or stroke.

    *Polygon points:[[0.5,0],[1,1],[0,1]] fill:0xFFF9C74F color:0xFF8A6D00 strokeWidth:2
    Parameter Type Default Description
    points list — Vertices [[x,y],…] (or flat [x,y,x,y,…] ).
    closed bool true Whether to connect the last vertex to the first.

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Points

    A polyline, a filled area or a scatter of dots from a list of points or values.

    *Points values:[30,42,38,55,48,63,58] mode:line color:0xFF22C55E strokeWidth:2 cap:round join:round
    Parameter Type Default Description
    points list — Explicit vertices [[x,y],…] (take precedence over values ).
    values list — y values: x is spread evenly, y is normalised over min..max.
    mode string line line | area | scatter .
    dotRadius double 3 Dot radius for mode:scatter .

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    *Path

    An arbitrary path from an SVG-like d string. Fill and/or stroke.

    *Path d:"M0,1 L0.25,0.4 L0.5,0.7 L0.75,0.2 L1,0.5" color:0xFF6C5CE7 strokeWidth:2
    Parameter Type Default Description
    d string '' Path data M/L/H/V/C/Q/A/Z : upper case — absolute fractions of the box, lower case — relative.
    fillRule string nonZero Fill rule: nonZero | evenOdd .

    Common drawing parameters: color , fill , stroke , strokeWidth , cap , join , gradientFrom , gradientTo , gradientAngle , blur , blendMode , antiAlias , draw , units , viewBox , width , height , z — see “Common drawing parameters” .

    A line that draws itself ( draw )

    draw: is a share of the stroke , not of the box: it is measured along the length of the outline, so on a jagged line the half falls in the middle of the path, not in the middle of the width. The fill stays whole — exactly as stroke-dashoffset in CSS does not touch fill .

    InView once:true seen:@seen
      Animated of:{seen ? 1 : 0} duration:900 curve:easeOut value:@t
        *Path d:"M0.02,0.7 C0.25,0.95 0.75,0.15 0.98,0.45" color:0xFF6C5CE7 strokeWidth:3 draw:$t

    Two things worth knowing:

    • On the site the browser measures the share after layout (the stroke length in a stretched coordinate system is only known from the box). Without JavaScript the page draws the whole stroke.
    • On a closed shape the stroke starts where its outline starts: for a circle that is three o'clock, clockwise. Shift it with *Transform rotate: .

    *Stack / effects

    The compositor and the effects wrap a * subtree:

    *Stack                         // draws children bottom to top in one box (z layers)
      *Colored color:0xFF12101F radius:12
      *Circle cx:0.5 cy:0.5 r:0.4 fill:0xFF6C5CE7
    
    *Clip shape:circle             // rect | rrect (radius:) | circle | path (d:)
      *Gradient from:0xFF6D5EF6 to:0xFFF9C74F angle:120
    
    *Transform rotate:20 origin:[0.5,0.5]   // rotate / scale / translate around origin
      *Rect x:0.2 y:0.3 w:0.6 h:0.4 radius:6 fill:0xFF4B9BFF
    
    *Opacity value:0.4             // group opacity (0 — draws nothing, 1 — no layer)
      *Circle cx:0.5 cy:0.5 r:0.42 fill:0xFFE84393

    *Transform is transparent to layout (the child keeps its box) — wrap it in *Clip to cut off what sticks out.

    *Stack

    Lays children into one box — the vector graphics compositor. Each child draws over the same box: first by its z: (larger is closer, drawn later; without z — 0), then in document order (the first at the bottom, the last on top). Children position themselves with fractional coordinates.

    *Stack
      *Arc value:0.72 r:0.45 strokeWidth:12 color:0xFF6C5CE7
      *Text "72%" color:0xFFFFFFFF align:center
    Parameter Type Default Description
    z double — The order of the *Stack itself among its siblings in the nearest *Stack / *Scene / *Artboard (see `z` ).

    *Clip

    Clips a subtree to a shape — a vector counterpart of ClipRRect / ClipPath without a Flutter widget. radius: and d: are read in the same coordinates as the primitives next to it: fractions of the box by default, surface units under an *Artboard / *Scene with viewBox , pixels with units:px .

    *Clip shape:rrect radius:16 units:px
      *Gradient from:0xFF6D5EF6 to:0xFF9B8AFB angle:120
    Parameter Type Default Description
    shape string rect rect | rrect | circle | path .
    radius double 0 Rounding for shape:rrect .
    d string — Path for shape:path (syntax as for *Path ).
    units string fractions Coordinate units: fractions 0..1 of the box, or px .
    viewBox [w,h] — A virtual w×h grid stretched over the box.
    z double — Drawing order — the key of the whole branch (see `z` ).

    *Transform

    Rotates, scales or shifts a subtree. Transparent to layout: the child keeps its box.

    *Transform rotate:45 origin:[0.5,0.5]
      *Rect fill:0xFF6C5CE7
    Parameter Type Default Description
    rotate double 0 Rotation in degrees.
    scale double — Scale on both axes.
    scaleX double = scale Scale on X.
    scaleY double = scale Scale on Y.
    translateX double 0 Shift on X — a fraction of the box width.
    translateY double 0 Shift on Y — a fraction of the box height.
    origin [x,y] centre The point of rotation and scaling, in fractions of the box.
    pivot [x,y] — The joint around which rotation and scaling happen, in surface units (the scene's viewBox pixels, like x / y of *Sprite ); takes precedence over origin . Nested *Transform s are bones: a child's pivot is written in the rest pose, and the parent's rotation carries it along.
    units string fractions Coordinate units for pivot : fractions 0..1 of the box, or px .
    viewBox [w,h] — A virtual w×h grid stretched over the box.
    z double — Drawing order — the key of the whole branch (see `z` ).

    *Opacity

    Group opacity of a subtree. With value:1 no separate layer is created (ordinary drawing), with value:0 nothing is drawn — the extra work is done only when it is needed.

    *Opacity value:0.4
      *Circle r:0.5 fill:0xFF00B894
    Parameter Type Default Description
    value double 1 Opacity 0..1 .
    z double — Drawing order — the key of the whole branch (see `z` ).

    *Repeat

    Stamps one template ( @Macros ) N times; the template's {...} expressions read the loop variables of their own iteration. Like ListView.builder , the loop gives the template only index and count — there are no implicit item / norm / accFrac ; the template reads the element and the aggregates from the data itself.

    Parameter Type Default Description
    count number length of values / over Number of iterations — an author's expression ( count:{length(values)} ) or @count from a generator.
    values list — A list whose length is the number of iterations, when count is not set.
    over list — Same as values : read when there is neither count nor values .

    The number of iterations is capped by the tree's list length limit; with a count over the limit not a single iteration is drawn (a cut-off chart would look like data that ran out).

    Template variable Value
    index Iteration index (from 0).
    count Number of iterations.
    What you need How to write it
    the element values[index]
    bar height 0..1 values[index] / max(values)
    share of the whole values[index] / sum(values)
    accumulated start (donut) accumulate(values)[index]
    colour by position pick(index, a, b, c, …) — cycling

    Aggregates over the whole list are computed once , in a *State above the loop, not on every iteration:

    // bar chart: one *Rect per value
    State @values:[12, 19, 15, 24, 18]
      *State @top:{max(values)}
        *Repeat count:{length(values)}
          @Macros index:0
            *Rect x:{index/count + 0.08/count} w:{0.84/count} y:{1 - values[index]/top} h:{values[index]/top} radius:3 fill:0xFF6D5EF6
    Variable name. A variable SHADOWS the expression function of the same name: by naming the aggregate max , you make max(...) unavailable in the whole subtree — hence @top .
    Unary minus at the start of an expression or an argument works ( {-90 + x} ); only a minus right after another operator is not supported — write {x - 2} , not {x + -2} .

    Charts as macros

    Since a whole chart is one *Repeat + one primitive with {...} maths, it folds neatly into a macro . The charts.reeel library ships four ready-made ones (put the file in the project's reeel/components/ and add import components/charts ):

    // what charts.reeel brings: four macros
    @Ring value:0 color:0xFF6C5CE7 trackColor:0x22FFFFFF strokeWidth:12 duration:400
      *State @rprog:$value
        *Animated of:$rprog value:@rv duration:$duration curve:easeOutCubic
          *Stack
            *Arc cx:0.5 cy:0.5 r:0.42 startAngle:-90 value:1 strokeWidth:$strokeWidth color:$trackColor
            *Arc cx:0.5 cy:0.5 r:0.42 startAngle:-90 value:$rv strokeWidth:$strokeWidth cap:round color:$color
    @Bars values:[] color:0xFF6D5EF6 duration:400
      *Animated of:$values value:@v duration:$duration curve:easeOutCubic
        *State @max:{max(v)}
          *Repeat count:{length(v)}
            @Macros index:0
              *Rect x:{index/count + 0.08/count} w:{0.84/count} y:{1 - v[index]/max} h:{v[index]/max} radius:3 fill:$color
    @Donut values:[] strokeWidth:20 duration:400
      *Animated of:$values value:@v duration:$duration curve:easeOutCubic
        *State @acc:{accumulate(v)} @total:{sum(v)}
          *Repeat count:{length(v)}
            @Macros index:0
              *Arc cx:0.5 cy:0.5 r:0.42 strokeWidth:$strokeWidth startAngle:{acc[index]/total*360 - 90} sweep:{v[index]/total*360 - 4} color:{pick(index, 0xFF6C5CE7, 0xFF00B894, 0xFFE17055, 0xFFF9C74F)}
    @Sparkline values:[] color:0xFF22C55E fill:0x2222C55E duration:400
      *Animated of:$values value:@v duration:$duration curve:easeOutCubic
        *Stack
          *Points values:$v mode:area fill:$fill
          *Points values:$v mode:line color:$color strokeWidth:2 cap:round join:round
    
    // the calls
    $Ring value:0.72 color:0xFF6C5CE7 strokeWidth:12
    $Bars values:[12, 28, 20, 44, 32, 38, 26] color:0xFF6D5EF6
    $Donut values:[35, 25, 22, 18] strokeWidth:22
    $Sparkline values:[30, 42, 38, 55, 48, 63, 58, 70, 60] color:0xFF22C55E fill:0x2222C55E

    Recipes (the macro bodies; each is wrapped in *Animated , so a data change is animated):

    Macro Built from
    $Ring $value A *Stack of two *Arc s — the full track ( value:1 ) + the progress arc (rounded end).
    $Bars $values *State @max:{max(v)} → *Repeat count:{length(v)} over *Rect , height {v[index]/max} , width {0.84/count} .
    $Donut $values *State @acc:{accumulate(v)} @total:{sum(v)} → *Repeat over *Arc : startAngle:{acc[index]/total*360 - 90} , sweep:{v[index]/total*360 - 4} , colours {pick(index, …)} .
    $Sparkline $values A *Stack of two *Points — the fill ( mode:area ) + the line ( mode:line ).

    Pass a reactive list and the chart comes alive: $Bars {revenue} color:0xFF9B8AFB , where @revenue is declared in a *State or comes from a data generator.

    Pattern: a dashboard card

    *Gradient (the background) can wrap Flutter content ( Padding / Column / Text ) as its child; the chart goes in as a * block (the $Bars macro from charts , or primitives directly).

    // the $Bars macro from charts.reeel
    @Bars values:[] color:0xFF6D5EF6 duration:400
      *Animated of:$values value:@v duration:$duration curve:easeOutCubic
        *State @max:{max(v)}
          *Repeat count:{length(v)}
            @Macros index:0
              *Rect x:{index/count + 0.08/count} w:{0.84/count} y:{1 - v[index]/max} h:{v[index]/max} radius:3 fill:$color
    
    *Gradient from:0xFF1E1B34 to:0xFF2A2550 angle:120 radius:20
      Padding
        #padding all 20
        Column crossAxisAlignment:start spacing:12
          Text "Revenue this week"
            #style color:0xFFEDEBFF fontSize:16 fontWeight:w600
          SizedBox height:96
            $Bars values:[12, 28, 20, 44, 32, 38, 26] color:0xFF9B8AFB

    Reactive values work inside * children: declare a variable in a *State (or get it from a generator — JsonData / HttpData ) and bind it with a {...} expression to a primitive's parameter — as a list ( values:{revenue} ) or as a scalar ( value:{progress} , height:{t*120} ). When the variable changes, the * layer is redrawn.

    *State @revenue:[12, 28, 20, 44, 32, 38, 26]
      *State @top:{max(revenue)}
        *Repeat count:{length(revenue)}
          @Macros index:0
            *Rect x:{index/count} w:{0.8/count} y:{1 - revenue[index]/top} h:{revenue[index]/top} radius:4 fill:0xFF9B8AFB

    *Animated

    A smooth transition for * elements (for ordinary elements Animated does the same). It watches the reactive of: and on every change drives the output variable the author declared, value:@v , from the value shown now to the new one over duration: with curve: . Children read {v} like any declared variable. The whole subtree recomputes its {...} on every animation frame and is redrawn .

    *State @scores:{[3, 7, 5]}
      *Animated of:$scores value:@v duration:400 curve:easeOut
        *State @max:{max(v)}
          *Repeat count:{length(v)}
            @Macros index:0
              *Rect x:{index/count} w:{0.9/count} y:{1 - v[index]/max} h:{v[index]/max} fill:0xFF6C5CE7
    Parameter Type Default Description
    value @var — The output variable the current value is written to. Without an @ variable *Animated does nothing.
    of any — The reactive series (or scalar) it watches. A change (compared by value) redirects the transition; the previous value is its start.
    duration int (ms) 400 Duration.
    curve string easeOut Curve name — any curve of the format ( linear , easeIn , easeInOut , easeOutCubic , easeOutQuint , easeOutBack , elasticOut , bounceOut , decelerate , …); an unknown name gives easeOut . Curves that go outside 0..1 pass through as they are.
    lerp callback — (from, to, t){…} instead of the standard element-wise interpolation (by default — element-wise, resampling when the length changes); returns the whole @v value for the frame — stepped appearances, your own per-point curves.
    controller number / string — The mode without of: : a scalar in the range from..to . A number is the target (clamped to the range); forward / fromStartToEnd — towards to ; reverse / fromEndToStart / reset — towards from ; stop / pause — hold the current value.
    from double 0 Start of the range for controller .
    to double 1 End of the range for controller .
    @mode:"fromStartToEnd"
    *Animated value:@t controller:$mode duration:900 curve:easeOutCubic
      *Arc value:$t r:0.45 color:0xFF6C5CE7 strokeWidth:12 cap:round width:120 height:120