json_screen 0.7.0+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 40

json_screen #

A widget builder by using json

take a look inside example/ folder to see how it works. You can use widget_builder/ folder's application to start the wiget builder(using gui)

[0.5.0] 2020.3.20 #

  • Added form container
  • Added widget_builder app
  • Added basic design

[0.5.4] 2020.3.20 #

  • Added timeline view

[0.5.5] 2020.3.20 #

  • Fixed bugs

[0.7.0] 2020.4.04 #

  • Added countdown view
  • Added support for xml file

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:json_screen/json_screen/views/json_screen.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      darkTheme: ThemeData.dark(),
      themeMode: ThemeMode.dark,
      theme: ThemeData(
        primarySwatch: Colors.blue,
        primaryTextTheme: TextTheme(
          bodyText1: TextStyle(color: Colors.black),
        ),
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("JSON Screen"),
        ),
        body: JsonScreen(
          onImageTap: (string) async {
            print(string);
          },
          onLinkTap: (string) async {
            print(string);
          },
          json: [
            {
              "types": "page",
              "containers": [
                {
                  "types": "container",
                  "blocks": [
                    {
                      "types": "header",
                      "level": 3,
                      "content": "This is the header"
                    },
                    {"types": "quote", "content": "Below is the content"},
                    {"types": "text", "content": "hello "},
                    {
                      "types": "link",
                      "content": "world",
                      "data": "https://google.com"
                    },
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {
                      "types": "header",
                      "level": 5,
                      "content": "Also Horizontal Carousel"
                    }
                  ]
                },
                {
                  "types": "horizontal",
                  "blocks": [
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    }
                  ]
                },
                {
                  "types": "container",
                  "blocks": [
                    {"types": "header", "level": 5, "content": "Story Card"}
                  ]
                },
                {
                  "types": "story",
                  "blocks": [
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {
                      "types": "image",
                      "content": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                    {"types": "text", "content": "hello story"}
                  ]
                }
              ]
            },
            {
              "types": "page",
              "containers": [
                {
                  "types": "container",
                  "blocks": [
                    {
                      "types": "table",
                      "content": "hello table",
                      "columns": [
                        {"types": "text", "content": "hello"},
                        {"types": "text", "content": "hello2"},
                        {"types": "text", "content": "hello3"},
                        {"types": "text", "content": "hello4"},
                        {"types": "text", "content": "hello5"},
                        {"types": "text", "content": "hello6"}
                      ],
                      "rows": [
                        [
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"}
                        ],
                        [
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"},
                          {"types": "text", "content": "abc"}
                        ]
                      ]
                    },
                    {
                      "types": "list",
                      "styles": "unordered",
                      "children": [
                        {"types": "text", "content": "list 1"},
                        {"types": "text", "content": "list 2"},
                        {
                          "types": "list",
                          "styles": "ordered",
                          "children": [
                            {"types": "text", "content": "list 3"},
                            {"types": "text", "content": "list 4"}
                          ]
                        }
                      ]
                    }
                  ]
                },
              ]
            },
            {
              "types": "page",
              "containers": [
                {
                  "types": "form",
                  "height": 200.0,
                  "schema": [
                    {
                      "label": "Item Name",
                      "readonly": false,
                      "extra": {
                        "help": "Please Enter your item name",
                        "default": ""
                      },
                      "name": "name",
                      "widget": "text",
                      "required": true,
                      "translated": false,
                      "validations": {
                        "length": {"maximum": 1024}
                      }
                    }
                  ]
                },
                {
                  "types": "timeline",
                  "blocks": [
                    {"types": "text", "content": "timeline 1", "label": "abc"},
                    {"types": "text", "content": "timeline 1", "label": "abc"},
                    {
                      "types": "image",
                      "content": "google",
                      "label": "google",
                      "data":
                          "https://www.google.com/logos/doodles/2020/spring-2020-northern-hemisphere-6753651837108323-l.png"
                    },
                  ]
                },
                {
                  "types": "container",
                  "blocks": [
                    {"types": "text", "content": "hello"}
                  ]
                }
              ]
            }
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  json_screen: ^0.7.0+5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:json_screen/json_screen.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
40
Overall:
Weighted score of the above. [more]
40
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Fix lib/json_screen/models/block.dart. (-1 points)

Analysis of lib/json_screen/models/block.dart reported 2 hints:

line 1 col 8: Unused import: 'package:json_screen/json_screen.dart'.

line 2 col 8: Unused import: 'package:json_screen/json_screen/models/converter.dart'.

Fix lib/json_screen/models/converter.dart. (-0.50 points)

Analysis of lib/json_screen/models/converter.dart reported 1 hint:

line 9 col 8: Duplicate import.

Format lib/json_screen/views/subviews/blocks/webview_view.dart.

Run flutter format to format lib/json_screen/views/subviews/blocks/webview_view.dart.

Maintenance issues and suggestions

Support latest dependencies. (-40 points)

The version constraint in pubspec.yaml does not support the latest published versions for 4 dependencies (carousel_slider, json_schema_form, story_view, xml).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
carousel_slider ^1.4.1 1.4.1 2.1.0
dio ^3.0.9 3.0.9
flutter 0.0.0
json_schema_form ^0.8.5 0.8.5 1.0.0+2
page_view_indicators ^1.3.1 1.3.1
photo_view ^0.9.2 0.9.2
story_view ^0.11.4 0.11.5 0.12.3
timeline_list2 ^0.1.0 0.1.0
webview_flutter ^0.3.19+9 0.3.22+1
xml ^3.5.0 3.7.0 4.1.0
Transitive dependencies
barcode_scan 2.0.2 3.0.1
charcode 1.1.3
clock 1.0.1
collection 1.14.12
convert 2.1.1
crypto 2.1.5
file 5.1.0
flutter_cache_manager 1.2.2
flutter_plugin_android_lifecycle 1.0.8
flutter_web_plugins 0.0.0
http 0.12.1
http_parser 3.1.4
image_picker 0.6.6+4
image_picker_platform_interface 1.0.0
intl 0.16.1
meta 1.1.8
nested 0.0.4
path 1.7.0
path_provider 1.6.9
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0
permission_handler 4.4.0+hotfix.4 5.0.0+hotfix.6
permission_handler_platform_interface 1.0.0 2.0.0
petitparser 3.0.2
platform 2.2.1
plugin_platform_interface 1.0.2
progress_indicators 0.1.5
provider 4.1.2
rxdart 0.23.1 0.24.1
sky_engine 0.0.99
source_span 1.7.0
sqflite 1.3.0+1
sqflite_common 1.0.1
string_scanner 1.0.5
synchronized 2.2.0
term_glyph 1.1.0
typed_data 1.1.6
uuid 2.0.4
vector_math 2.0.8
video_player 0.10.11+1
video_player_platform_interface 2.0.2
video_player_web 0.1.3+1
Dev dependencies
flutter_test