You are currently viewing Flutter Forms

Flutter Forms

Even though you can easily create forms with fields and buttons easily using textfields and buttons as components, you can leverage existing libraries that allow you create forms even easier. In this piece we want to look at these solutions with examples.

(a). folly_fields

Basic form fields and utilities.

Step 1: Install it

This library is hosted in github and you can pull it directly from there:

# https://github.com/edufolly/folly_fields
folly_fields:
  git:
    url: git://github.com/edufolly/folly_fields.git
    rev: # lastest release

You can find the latest release here.

Step 2: Use

Heres an example usage :

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Folly Fields Example',
      theme: ThemeData(
        primarySwatch: Colors.deepOrange,
      ),
      home: MyHomePage(),
      localizationsDelegates: <LocalizationsDelegate<dynamic>>[
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: const <Locale>[
        Locale('pt', 'BR'),
      ],
    );
  }
}

Then in the main.dart:

void main() {
  bool debug = false;
  assert(debug = true);
  WidgetsFlutterBinding.ensureInitialized();
  FollyFields.start(Config(), debug: debug);
  runApp(MyApp());
}

Find full example here

Leave a Reply