Skip to content

sharansingh00002/backend-to-ui-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Json/Backend response to UI parser

A new Flutter project to parse Json data to render UI widgets

Parsers

Parsers added currently - 

Container
Padding
Center
Text
Column
Row
ListView
Gradient - Linear & Radial

Example code - 

Create a valid json String 

  var jsonData =   '''
  {
    "Padding": {
      "padding": "EdgeInsets.only(top: 40)",
      "child": {
        "Container": {
          "child": {"Column": {
            "mainAxisAlignment": "MainAxisAlignment.center",
            "crossAxisAlignment": "CrossAxisAlignment.center",
            "children": [
              {
                "Container": {
                  "color": "0xffff11ff",
                  "height": 150,
                  "width": 150
                }
              },
              {"Padding": {"padding": "EdgeInsets.only(top: 40)",
                "child": {"Text": {"text": "helllooo",
                  "style": {
                    "fontSize": 24,
                    "color": "0xffffffff",
                    "fontWeight": "bold"
                  }}}}}
            ]
          }},
          "color": "0xffff11ff",
          "height": "300",
          "width": "300",
          "borderRadius": 32,
          "alignment": "Alignment.center",
          "gradient": {
            "LinearGradient": {"colors": ["0xff11ffff", "0xffff11ff"],
              "begin": "Alignment.topLeft",
              "end": "Alignment.bottomRight"}}
        }
      }
    }
  }'''
Use Parse to parse above data - Parser.parse(jsonData)

Above code renders the following widget

Screenshot 2022-01-01 at 1 31 52 PM

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages