easy_auto_form 0.0.2+6 copy "easy_auto_form: ^0.0.2+6" to clipboard
easy_auto_form: ^0.0.2+6 copied to clipboard

EasyAutoForm is a Flutter package that generates a Form based on a given entity, supporting a variety of entity types and input types.

example/example.dart

import 'package:easy_auto_form/easy_auto_form.dart';

import 'package:flutter/material.dart';

class TestPage extends StatefulWidget {
  const TestPage({super.key});

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  final formKey = GlobalKey<FormState>();
  @override
  Widget build(BuildContext context) {
    var entity = <String, dynamic>{
      "name": "test",
      "age": 30,
      "height": 1.8,
      "isMarried": true,
    };
    return Scaffold(
      appBar: AppBar(
        title: const Text('TestPage'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: EasyAutoForm(
            formKey: formKey,
            entity: entity,
            runDirection: RunDirection.vertical,
            expanded: true,
            onSave: (entity) {
              print(entity);
            },
            onCancel: () {},
            fieldsSettings: FieldsSettings(
              settings: [
                FieldSetting(
                    fieldKey: "name",
                    inputType: FieldInputType.autocomplete,
                    autocompleteSource: AutocompleteSource(
                      source: (pattern) async => [
                        "test",
                        "test2",
                        "test3",
                        "test4"
                      ].where((element) => element.contains(pattern)).toList(),
                    ))
              ],
            ),
          ),
        ),
      ),
    );
  }
}
2
likes
150
pub points
34%
popularity

Publisher

unverified uploader

EasyAutoForm is a Flutter package that generates a Form based on a given entity, supporting a variety of entity types and input types.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on easy_auto_form