form_submit_button 0.1.0

Make use of FormState in a StatelessWidget Form. #

A button to be used in a Form, which will pass the Form's state in the onPressed method.

Why use StatelessWidget? #

If you are using the container/presentation pattern and want to use the Form as a presentation component, which most of the time you do, you would want somehow to get a hold of the FormState.

How to use it #

Check the example.

Change Log for form_submit_button #

A button to be used in a Form, which will pass the Form's state in the onPressed method.

v0.1.0 - 2019-03-19

Chore #

Docs #

Test #

This was generated with Changelog for Dart


import 'package:flutter/material.dart';
import 'package:form_submit_button/form_submit_button.dart';

typedef FormSubmittedCallback = void Function(Map<String, String>);

class FormPresentation extends StatelessWidget {
  final Map<String, String> values = const {};

  /// Input
  final String initialValue;

  /// Output
  final FormSubmittedCallback formSubmitted;

  const FormPresentation({Key key, this.initialValue, this.formSubmitted})
      : super(key: key);

  Widget build(BuildContext context) {
    return Form(
      child: Column(
        children: <Widget>[
            decoration: InputDecoration(labelText: 'Field1'),
            onSaved: (value) => values['Field1'] = value,
            initialValue: this.initialValue,
            child: Text('submit'),
            submit: (FormState state) {
              if (state.validate()) {

class FormContainer extends StatefulWidget {
  _FormContainerState createState() => _FormContainerState();

class _FormContainerState extends State<FormContainer> {
  Widget build(BuildContext context) {
    return FormPresentation(
      initialValue: 'value',
      formSubmitted: (Map<String, String> values) {
        //Probably serialize it to your model here and use a BLoC to save it

main() {
    title: 'FormSubmitButton Example',
    home: Scaffold(
      body: FormContainer(),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  form_submit_button: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:form_submit_button/form_submit_button.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies