json_to_widget 0.0.5+2 copy "json_to_widget: ^0.0.5+2" to clipboard
json_to_widget: ^0.0.5+2 copied to clipboard

retractedoutdated

Payload A flutter plugin to use convert Json to widget

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:json_to_widget/json_to_widget.dart';

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

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String form = json.encode({
    'fields': [
      {
        'key': 'input1',
        'type': 'Input',
        'label': 'Username',
        'placeholder': "Enter Your Username",
        'required': true
      },
      {
        'key': 'password1',
        'type': 'Password',
        'label': 'Password',
        'required': true
      },
    ]
  });

  dynamic response;

  Map decorations = {
    'input1': InputDecoration(
        prefixIcon: Icon(Icons.account_box), border: OutlineInputBorder()),
    'password1': InputDecoration(
        prefixIcon: Icon(Icons.security), border: OutlineInputBorder())
  };

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Login"),
      ),
      body: Column(
        children: <Widget>[
          const Text(
            "Login Form",
            style: TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold),
          ),
          JsonWidget(
            decorations: decorations,
            form: form,
            onChanged: (dynamic response) {
              this.response = response;
            },
            actionSave: (data) {
              print(data);
            },
            buttonSave: Container(
              height: 40.0,
              color: Colors.blueAccent,
              child: const Center(
                child: Text("Login",
                    style: TextStyle(
                        color: Colors.white, fontWeight: FontWeight.bold)),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
2
likes
0
pub points
49%
popularity

Publisher

unverified uploader

Payload A flutter plugin to use convert Json to widget

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on json_to_widget