xform 0.1.0 copy "xform: ^0.1.0" to clipboard
xform: ^0.1.0 copied to clipboard

outdated

A Flutter plugin for easy form building. Built in with textfield types, validation and pagination.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:xform/xform.dart';
import 'dart:async';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  GlobalKey scaffoldKey = GlobalKey();
  @override
  Widget build(BuildContext context) {
    Future _submit(formData) async {
      showDialog(
        context: scaffoldKey.currentState.context,
        builder: (BuildContext context) {
          return AlertDialog(
            title: Text("Form Data"),
            content: Text(formData.toString()),
            actions: <Widget>[
              FlatButton(
                child: Text("Close"),
                onPressed: () {
                  Navigator.of(context).pop();
                },
              ),
            ],
          );
        },
      );
    }

    return MaterialApp(
      home: Scaffold(
        key: scaffoldKey,
        appBar: AppBar(
          title: const Text('XForm'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: XForm(submit: _submit, children: <Widget>[
            ListView(children: <Widget>[
              XTextField(
                name: "name",
                label: "Name",
                required: true,
              ),
              XTextField(
                name: "number",
                label: "Number",
                type: FieldType.numeric,
              ),
              XTextField(
                name: "email",
                label: "Email Address",
                type: FieldType.email,
              ),
              XTextField(
                name: "password",
                label: "Password",
                type: FieldType.password,
              ),
            ]),
            ListView(children: <Widget>[
              XDateField(
                name: "date",
                label: "Date of Birth",
                defaultValue: DateTime.now(),
              ),
              XSelectField(
                name: "options",
                label: "Options",
                required: true,
                options: [Option(name: "Name", value: "value")],
              )
            ]),
          ]),
        ),
      ),
    );
  }
}
4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A Flutter plugin for easy form building. Built in with textfield types, validation and pagination.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, intl, validate

More

Packages that depend on xform