dengyin2000 / dynamic_widget

A Backend-Driven UI toolkit, build your dynamic UI with json, and the json format is very similar with flutter widget code.
Apache License 2.0
1.56k stars 309 forks source link

Some values return null when exporting #65

Closed mike-gallego closed 3 years ago

mike-gallego commented 3 years ago

Hello, I really like this package and was wondering if I am exporting correctly, because I keep getting null values on some properties. Am I supposed to add a parser before I export or is exporting using DynamicWidgetJsonExportor the best way? And also some properties are not being caught, such as decoration, which I need to provide a background in the container.

Widget:

Container(
                height: 200,
                margin: EdgeInsets.symmetric(horizontal: 15.0),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(20.0)),
                  image: DecorationImage(
                    image: AssetImage('assets/weather/clear-day/bg.jpg'),
                    colorFilter: ColorFilter.mode(
                        Colors.black.withOpacity(0.75), BlendMode.dstATop),
                    fit: BoxFit.cover,
                  ),
                ),
                child: Stack(
                  children: [
                    Align(
                      alignment: Alignment.topLeft,
                      child: IconButton(
                        onPressed: () => debugPrint('testing'),
                        icon: Icon(Icons.ac_unit),
                      ),
                    ),
                    Align(
                      alignment: Alignment.topRight,
                      child: IconButton(
                        onPressed: () => debugPrint('testing2'),
                        icon: Icon(Icons.access_alarm),
                      ),
                    ),
                  ],
                ),)

exported Json from widget above:

{
    "type": "Container",
    "alignment": null,
    "padding": null,
    "color": null,
    "margin": "15.0,0.0,15.0,0.0",
    "constraints": {
        "minWidth": 0.0,
        "maxWidth": 9999999999.0,
        "minHeight": 200.0,
        "maxHeight": 200.0
    },
    "child": {
        "type": "Stack",
        "alignment": "topStart",
        "textDirection": "ltr",
        "fit": "loose",
        "clipBehavior": "hardEdge",
        "children": [
            {
                "type": "Align",
                "alignment": "topLeft",
                "widthFactor": null,
                "heightFactor": null,
                "child": null
            },
            {
                "type": "Align",
                "alignment": "topRight",
                "widthFactor": null,
                "heightFactor": null,
                "child": null
            }
        ]
    }
}

As you can see, decoration is not being exported, and also my iconbuttons in the stack are all null. Any reason for this?

dengyin2000 commented 3 years ago

image

decoration property is not exported, and "null" is the default value for alignment