Fair 2.0 release! What’s new

# Template

A dynamic template can be thought of as a JSON representation of the widget tree.

# Node description

Each Widget node has three key contents:

  1. Component name className
  2. Parameter Positional Arguments, referred to as pa
  3. Named Arguments, na for short

# Example

The following code is a dynamic component representing a 300x300 red square with a text label nested inside.

{
  "className": "Center",
  "na": {
    "child": {
      "className": "Container",
      "na": {
        "child": {
          "className": "Text",
          "pa": [
            "Nested Dynamic Components"
          ],
          "na": {
            "style": {
              "className": "TextStyle",
              "na": {
                "fontSize": 30,
                "color": "#(Colors.yellow)"
              }
            }
          }
        },
        "alignment": "#(Alignment.center)",
        "margin": {
          "className": "EdgeInsets.only",
          "na": {
            "top": 30,
            "bottom": 30
          }
        },
        "color": "#(Colors.redAccent)",
        "width": 300,
        "height": 300
      }
    }
  }
}
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
Last Update: 6/28/2022, 4:40:25 PM
Copyright © 2020 58.com | Powered by The Fair Authors