form_widgets 1.0.1 copy "form_widgets: ^1.0.1" to clipboard
form_widgets: ^1.0.1 copied to clipboard

Additional form widgets for Flutter. Including checkbox form widget.

Form Widgets #

This package provides custom form widgets for Flutter applications.

Widgets #

CheckboxFormField #

A FormField that contains a CheckboxListTile.

Properties

  • title: The title widget to display next to the checkbox.
  • onSaved: Called when the form is saved.
  • validator: Called to validate the form field.
  • initialValue: The initial value of the checkbox.
  • onChanged: Called when the value of the checkbox changes.

ClickableTextFormWidget #

A custom widget that combines a TextFormField with a TextButton.

Properties

  • labelText: The label text to display inside the TextFormField.
  • controller: The controller for the TextFormField.
  • validator: The validator for the TextFormField.
  • onPressed: The callback function to be called when the TextButton is pressed.

Usage #

To use these widgets, import the package and include them in your form:

import 'package:form_widgets/checkbox_form_widget.dart';
import 'package:form_widgets/clickable_text_form_widget.dart';

...

CheckboxFormField(
  initialValue: false,
  onChanged: (value) {},
  title: const Text('Terms and Conditions'),
  validator: (value) {
    if (value == null || value == false) {
      return 'You must accept the terms';
    }
    return null;
  },
),

DateTime? _selectedDateTime;
final _dateController = TextEditingController();
ClickableTextFormWidget(
  labelText: 'Date',
  controller: _dateController,
  validator: (value) =>
      value == null || value.isEmpty ? 'Please select a date' : null,
  onPressed: () {
    showDatePicker(
      context: context,
      initialDate: _selectedDateTime ?? DateTime.now(),
      firstDate: _selectedDateTime ?? DateTime.now(),
      lastDate: DateTime(2100),
    ).then((value) {
      if (value != null) {
        setState(() {
          _selectedDateTime = value;
          _dateController.text =
              '${value.day}/${value.month}/${value.year}';
        });
      }
    });
  },
);

ScreenShots #

Screenshot_1735602505 Screenshot_1735602511 Screenshot_1735602524

1
likes
160
points
18
downloads

Publisher

verified publisherflexxxlab.com

Weekly Downloads

Additional form widgets for Flutter. Including checkbox form widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on form_widgets