smart_forms 2.1.2 copy "smart_forms: ^2.1.2" to clipboard
smart_forms: ^2.1.2 copied to clipboard

outdated

A flutter forms generator based on objects with multiple parameters.

example/main.dart

import 'package:flutter/material.dart';
import 'package:smart_forms/models/field.model.dart';
import 'package:smart_forms/models/form.model.dart';
import 'package:smart_forms/smart_forms.dart';
import 'package:smart_forms/utils/enums.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: 'Smart Forms',
      theme: ThemeData(
        primarySwatch: Colors.black,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Smart Forms'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  FormModel _form;

  _formDone(Map<String, dynamic> res) {
    print(res);
  }

  @override
  void initState() {
    _form = FormModel(
        submitButton: "Submit",
        resetButton: "Restart",
        name: "Test",
        fields: [
          FieldModel(
            label: "Field 1",
            type: Types.number,
            vallidate: true,
          ),
          FieldModel(
            label: "Field 2",
            type: Types.text,
            vallidate: true,
          )
        ]);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: SmartForms(
          form: _form,
          callback: _formDone,
        ),
      ),
    );
  }
}
7
likes
0
pub points
40%
popularity

Publisher

verified publisherfjbatresv.com

A flutter forms generator based on objects with multiple parameters.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, intl

More

Packages that depend on smart_forms