GitHub issues GitHub forks GitHub stars GitHub license Pub style: effective dart GitHub tag (latest SemVer) GitHub top language GitHub contributors GitHub last commit Flutter CI

Convert JSON to Widget validating with JSON Schema for Flutter apps

What is it

The spinkit_schema_parser is a parser implementation to flutter_spinkit Flutter package implemented with base on schema_widget package that produces widgets dynamically interpreting JSON objects.

Installation

  • Add this to your package's pubspec.yaml file:
dependencies:
  get_it:
  spinkit_schema_parser: ^1.1.0-0
  • Install packages from the command line: with Flutter:
$ flutter packages get
  • Import it into the code file:
 import 'package:spinkit_schema_parser/spinkit_schema_parser.dart'; 

Usage

import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:schema_widget/schema_widget.dart';
import 'package:spinkit_schema_parser/spinkit_schema_parser.dart';


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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'SpinKit Rotating Circle Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
          child: FutureBuilder(
            future: GetIt.I.allReady(ignorePendingAsyncCreation: false),
            builder: (buildContext, snapshot) {
              if (snapshot.hasData) {
                return SchemaWidget.parse<Widget>(context, {
                  "type": "SpinKitRotatingCircle",
                  "color": 0xFF000000,
                });
              }

              return Container();
            },
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _incrementCounter,
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
      ),
    );
  }
}

Next steps

  • x Publish Package;
  • x Make MVP;
  • x Minimal documentation;
  • x Add list of default supported Widgets;
  • x Add list of default supported Types;
  • Add more spin implementations;
  • Create content about;

Libraries

schema_parser_initiator.g
spin_kit_rotating_circle_schema_widget_parser
spinkit_schema_parser