checkbox_formfield 0.1.0+3

Flutter Android iOS web

This package contains checkbox widgets that can be used as FormField for Flutter beginners.

checkbox_formfield #

pub package

A few kinds of checkbox that can be used as FormField

Getting Started #

This library currently has two Widgets.

  • CheckboxListTileFormField: Use CheckboxListTile in Form
  • CheckboxIconFormField: Use two Icons as if they consist a checkbox and also in Form

Demo #

Demo

Usage sample #

class TaskEditPage extends StatelessWidget {
  final _formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Sample',
        ),
      ),
      body: Padding(
        padding: EdgeInsets.all(16),
        child: Column(
          children: <Widget>[
            Form(
              key: _formKey,
              child: Column(
                children: <Widget>[
                  CheckboxListTileFormField(
                    title: Text('Check!'),
                    onSaved: (bool value) {},
                    validator: (bool value) {
                      if (value) {
                        return null;
                      } else {
                        return 'False!';
                      }
                    },
                  ),
                  CheckboxIconFormField(
                    iconSize: 32,
                    onSaved: (bool value) {},
                  ),
                  RaisedButton(
                    onPressed: () {
                      if (_formKey.currentState.validate()) {
                        _formKey.currentState.save();
                      }
                    },
                    child: Text('Submit'),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Specifications #

CheckboxListTileFormField #

ParameterDescription
keyFormField.key
titleCheckboxListTile.title
contextProvide a default color to errorColor
onSavedFormField.onSaved
validatorFormField.validator
initialValueFormField.initialValue
autovalidateFormField.autovalidate
enabledWhether the checkbox is enabled
denseCheckboxListTile.dense
errorColorColor of error message
Default: Theme.errorColor (context is given), Colors.red (otherwise)
activeColorCheckboxListTile.activeColor
checkColorCheckboxListTile.checkColor
controlAffinityCheckboxListTile.controlAffinity
secondaryCheckboxListTile.secondary

CheckboxIconFormField #

ParameterDescription
keyFormField.key
contextProvide a default color to errorColor
onSavedFormField.onSaved
initialValueFormField.initialValue
autovalidateFormField.autovalidate
enabledWhether the checkbox is enabled
trueIconIconData if true
Default: Icons.check
falseIconIconData if false
Default: Icons.check_box_outline_blank
trueIconColorColor if true
Default: Theme.accentIconTheme.color (if context is given), Theme.iconTheme.color (otherwise)
falseIconColorColor if false
Default: Theme.iconTheme.color
disabledColorColor if disabled
Default: Theme.disabledColor
paddingpadding
Default: 24.0
iconSizeIcon.size
7
likes
100
pub points
84%
popularity

This package contains checkbox widgets that can be used as FormField for Flutter beginners.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

kdaimon.8@gmail.com

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on checkbox_formfield