flutter_input library

Provides input widgets for data manipulation which can be used standalone or within a form.

An input widget is used to change the value of a variable through user interaction. This library provides input widgets for all types of variables: bool, int, double, String and DateTime. All input widgets share a common set of parameters which makes them easier to use. This common set of parameters can be found at InputField.

Input Utilities

Form and some input widgets rely on utility methods which can be used anywhere:

DateHelperExtension provides extensions for DateTime objects:

Architecture

This library is based on the following design criteria:

  1. Provide an easy to understand library for data input which is easy to use, to maintain and to extend.
  2. All input widgets share a common set of parameters (see InputField).
  3. The InputForm provides a central data object. InputForm.value is a Map which can be nested. The form provides methods to enable() , validate() or save() the values from all input widgets.
  4. An input widget automatically attaches itself to the InputForm by its parameter InputField.path. This parameter is also used to obtain an initial value and to save back the widget value after editing.
  5. Any input widget can be used stand alone, even when it is a descendant of a form. For this, path must be null and onChanged must not be null.
  6. Input widgets inherit as much decoration from the form as possible while this can still be overwritten by the input widget.
  7. Each input widget accepts a list of reusable validators by parameter InputField.validators like 'NotNull', 'Min', 'Max', 'Future', 'Past', ...
  8. Input widgets do not have parameters for type conversion. If this is required in some case, just use your converter on parameters initialValue and onSave.
  9. All input widgets should have an ".adaptive" constructor allowing them to be used by Android and iOS. (Not implemented yet)

Classes

DateHelper
Provides static methods for date computations which are not available in Dart 2.7.0. [...]
DatePickerStyle
Styles for an InputDatePicker.
DatePickerStyles
All styles for a date picker. [...]
InputCheckbox
Provides a checkbox to manipulate a bool value.
InputCountry
An input widget to select a country code from a sorted list of country names. [...]
InputDate
Input widget for a date picker. [...]
InputDatePicker
Provides a date picker for a DateTime value. [...]
InputDateTime
An input widget for date and / or time. [...]
InputDropdown<T>
Provides a drop down button for a selection list
InputFavorite
Provides a favorite button to set a bool value. The icons for a favorite or not can be set separately.
InputField<T>
A single form field. [...]
InputFieldState<T>
The current state of an InputField.
InputForm
A container to group input fields for data manipulation. It allows enabling / disabling, validation and saving of all input fields. It can provide an InputDecoration which is used by the input fields. [...]
InputFormState
State associated with an InputForm widget. [...]
InputKeyboard<T>
An InputField that contains a TextField for one of type String, int or double. [...]
InputLanguage
Provides a text with the current language and a trailing icon. [...]
InputRadio<T>
Provides a group of radio buttons which can be aligned vertically (default) or horizontally.
InputRating
Provides a horizontal rating displaying empty, half and full icons. This 3 icons can be given as parameters. They default to stars. The rating value can be set with parameters min (default = 0), max (default = 100) and initialValue (default = 1). [...]
InputSlider
Provides a slider to select a value with type double between a given minimum and a given maximum.
InputSpinner<T extends num>
Provides a spinner to set a value between min and max. [...]
InputSwitch
Provides a switch to manipulate a bool value
InputText
An InputField that contains a TextField. [...]
InputUtils

Extensions

DateHelperExtension
Extensions on DateTime. [...]

Properties

monthNamesLong → List<String>
final
monthNamesShort → List<String>
final
weekDaysLong → List<String>
Long names for the days of the week. 1 = Monday, ..., 7 = Sunday
final
weekDaysShort → List<String>
final

Functions

after(DateTime fieldValue, DateTime checkValue, {String message}) → String
Contains standard validators which can be attached to an input field. [...]
before(DateTime fieldValue, DateTime checkValue, {String message}) → String
Validates that fieldValue (DateTime) is before checkValue. [...]
future(DateTime fieldValue, {String message}) → String
Validates that fieldValue (DateTime) is in the future. [...]
max(num fieldValue, int maxVal, {String message}) → String
Validates that fieldValue (int or double) is equal to or smaller than maxVal. [...]
maxLength(String fieldValue, int maxLen, {String message}) → String
Validates that the string fieldValue is not longer than maxLen. [...]
min(num fieldValue, int minVal, {String message}) → String
Validates that fieldValue (int or double) is equal to or larger than minVal. [...]
minLength(String fieldValue, int minLen, {String message}) → String
Validates that the string fieldValue is not shorter than minLen. [...]
notNull(dynamic fieldValue, {String message}) → String
Checks if the given value is not null.
past(DateTime fieldValue, {String message}) → String
Validates that fieldValue (DateTime) is in the past. [...]

Enums

DateTimeFormat
Enumeration of formats for dates and times.
DateTimeUsing
Enumeration about which part of a DateTime object is used. A value of 'null' is treated same as dateAndTime. Should be part of DateTime class.

Typedefs

InputFieldSetter<T>(T newValue) → void
Signature for being notified when a form field changes value. [...]
InputValidator(dynamic value) → String
Signature for validating a form field. [...]
ValueTransformer<S, T>(T value) → S
Transform a value of type T into a value of type S. [...]