smart_forms 2.2.4 icon indicating copy to clipboard operation
smart_forms: ^2.2.4 copied to clipboard

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 as MaterialColor?,
        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
110
pub points
23%
popularity

Publisher

unverified uploader

A flutter forms generator based on objects with multiple parameters.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter, intl

More

Packages that depend on smart_forms