duskmoon_form library
Form state management and adaptive form widgets for DuskMoon Design System.
Merges BLoC-based form state management with platform-adaptive form field widgets. Import this single library to access all DuskMoon Form components.
Classes
-
Bloc<
Event, State> -
Takes a
StreamofEventsas input and transforms them into aStreamofStatesas output. -
BlocBase<
State> - An interface for the core functionality implemented by both Bloc and Cubit.
-
BlocBuilder<
B extends StateStreamable< S> , S> -
BlocBuilder handles building a widget in response to new
states. BlocBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed as well as bloc-specific performance improvements. Please refer to BlocListener if you want to "do" anything in response tostatechanges such as navigation, showing a dialog, etc... -
BlocBuilderBase<
B extends StateStreamable< S> , S> - Base class for widgets that build themselves based on interaction with a specified bloc.
-
BlocConsumer<
B extends StateStreamable< S> , S> -
BlocConsumer exposes a builder and listener in order react to new
states.
BlocConsumer is analogous to a nested
BlocListenerandBlocBuilderbut reduces the amount of boilerplate needed. BlocConsumer should only be used when it is necessary to both rebuild UI and execute other reactions to state changes in the bloc. -
BlocEventSink<
Event extends Object?> - An ErrorSink that supports adding events.
-
BlocListener<
B extends StateStreamable< S> , S> -
Takes a BlocWidgetListener and an optional bloc and invokes
the listener in response to
statechanges in the bloc. It should be used for functionality that needs to occur only in response to astatechange such as navigation, showing aSnackBar, showing aDialog, etc... The listener is guaranteed to only be called once for eachstatechange unlike thebuilderinBlocBuilder. -
BlocListenerBase<
B extends StateStreamable< S> , S> - Base class for widgets that listen to state changes in a specified bloc.
- BlocObserver
- An interface for observing the behavior of Bloc instances.
-
BlocProvider<
T extends StateStreamableSource< Object?> > -
Takes a
createfunction that is responsible for creating the Bloc or Cubit and a child which will have access to the instance viaBlocProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a Bloc or Cubit can be provided to multiple widgets within a subtree. -
BlocSelector<
B extends StateStreamable< S> , S, T> - BlocSelector is analogous to BlocBuilder but allows developers to filter updates by selecting a new value based on the bloc state. Unnecessary builds are prevented if the selected value does not change.
-
BooleanFieldBloc<
ExtraData> -
A
FieldBlocused forbooltype. -
BooleanFieldBlocState<
ExtraData> -
Change<
State> -
A Change represents the change from one
Stateto another. A Change consists of the currentState and nextState. - CheckboxFieldTheme
- The theme of CheckboxFieldBlocBuilder and CheckboxGroupFieldBlocBuilder
- ChipFieldItem
- ChoiceChipFieldTheme
- The theme of ChoiceChipFieldBlocBuilder
- ClearSuffixButton
- ClearSuffixButtonTheme
- The theme of ClearSuffixButton
- Closable
- An object that must be closed when no longer in use.
-
Cubit<
State> - A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
- DateFormat
- DateFormat is for formatting and parsing dates in a locale-sensitive manner.
- DateTimeFieldTheme
- The theme of DateTimeFieldBlocBuilder
- DmCanShowFieldBlocBuilder
- DmCheckboxFieldBlocBuilder
- A material design checkbox.
-
DmCheckboxGroupFieldBlocBuilder<
Value> - A material design checkboxes.
-
DmChoiceChipFieldBlocBuilder<
T> - FilterChip
- DmDateTimeFieldBlocBuilder
-
DmDropdownFieldBlocBuilder<
Value> - A material design dropdown.
-
DmFilterChipFieldBlocBuilder<
T> - FilterChip
-
DmFormBlocListener<
FB extends FormBloc< SuccessResponse, ErrorResponse> , SuccessResponse, ErrorResponse> - BlocListener that reacts to the state changes of the FormBloc.
- DmFormTheme
- DmFormThemeProvider
-
DmRadioButtonGroupFieldBlocBuilder<
Value> - A material design radio buttons.
- DmScrollableFieldBlocTarget
- Mark the widget as a possible scroll target
- DmScrollableFieldBlocTargetState
- DmScrollableFormBlocManager
- Allows you to make the first wrong child visible
- DmSimpleFieldBlocBuilder
- Use these widgets:
- DmSliderFieldBlocBuilder
- Slider
-
DmStepperFormBlocBuilder<
T extends FormBloc> - DmSwitchFieldBlocBuilder
- A material design switch
- DmTextFieldBlocBuilder
- A material design text field that can show suggestions.
- DmTimeFieldBlocBuilder
- DropdownFieldTheme
- The theme of DropdownFieldBlocBuilder
- EditableText
- A basic text input field.
-
Emittable<
State extends Object?> - An object that can emit new states.
-
EmittableStateStreamableSource<
State> - A StateStreamableSource that can emit new states.
-
Emitter<
State> - An Emitter is a class which is capable of emitting new states.
- ErrorSink
- A generic destination for errors.
- FieldBlocBuilder
-
FieldBlocState<
Value, Suggestion, ExtraData> - FieldBlocValidators
- FieldBlocValidatorsErrors
- FieldItem
- Class that defines the properties of an item contained in a field
- FieldTheme
- Represents the basic theme for a field
- FieldThemeResolver
- Resolves looking for the appropriate value to use in the widget
- FilterChipFieldTheme
- The theme of FilterChipFieldBlocBuilder
- FlexGroupStyle
- Flex
-
FormBloc<
SuccessResponse, FailureResponse> -
The base class for all
FormBlocs. -
FormBlocDeleteFailed<
SuccessResponse, FailureResponse> - It is the state when the form are deleting and fail. The previous state must be FormBlocDeleting.
-
FormBlocDeleteSuccessful<
SuccessResponse, FailureResponse> - It is the state when the form is deleted successfully. The previous state must be FormBlocDeleting.
-
FormBlocDeleting<
SuccessResponse, FailureResponse> - It is the state when FormBloc.delete is called.
-
FormBlocFailure<
SuccessResponse, FailureResponse> - It is the state when the form are submitting and fail. The previous state must be FormBlocSubmitting.
-
FormBlocLoaded<
SuccessResponse, FailureResponse> -
It is the state when you can
submitthe FormBloc. -
FormBlocLoadFailed<
SuccessResponse, FailureResponse> -
It is the state when you failed to pre/fill the
fieldBlocs. The previous state must be FormBlocLoading. -
FormBlocLoading<
SuccessResponse, FailureResponse> -
It is the state when you need to pre/fill the
fieldBlocsusually with asynchronous data. The previous state must be FormBlocLoading. - FormBlocObserver
-
FormBlocObserver hide
eventsandtransitionsof any FieldBloc or FormBloc from the child. -
FormBlocState<
SuccessResponse, FailureResponse> - The base class for all Form Bloc States:
- FormBlocStep
-
A material step used in
Stepper. The step can have a title and subtitle, an icon within its circle, some content and a state that governs its styling. -
FormBlocSubmissionCancelled<
SuccessResponse, FailureResponse> - It is the state that you must yield last in the method FormBloc.onCancelingSubmission. The previous state must be FormBlocSubmitting.
-
FormBlocSubmissionFailed<
SuccessResponse, FailureResponse> -
It is the state when the
FormBlocState._isValidByStepisfalseand FormBloc.submit is called. -
FormBlocSubmitting<
SuccessResponse, FailureResponse> - It is the state when the FormBloc is submitting. It is called automatically when FormBloc.submit is called successfully, and usually is used to update the submission progress.
-
FormBlocSuccess<
SuccessResponse, FailureResponse> - It is the state when the form is submitted successfully. The previous state must be FormBlocSubmitting.
-
FormBlocUpdatingFields<
SuccessResponse, FailureResponse> - It is the state when the form is updating the fields.
- FormBlocUtils
- GridGroupStyle
- GridView
-
GroupFieldBloc<
T extends FieldBloc< FieldBlocStateBase> , ExtraData> -
GroupFieldBlocState<
T extends FieldBloc< FieldBlocStateBase> , ExtraData> - GroupStyle
- Base class for the style of GroupView
- GroupView
- You can build the layout of your items (group) based on the style you want to apply.
-
InputFieldBloc<
Value, ExtraData> -
A
FieldBlocused for any type, for exampleDateTimeorFile. -
InputFieldBlocState<
Value, ExtraData> -
ListFieldBloc<
T extends FieldBloc< FieldBlocStateBase> , ExtraData> -
ListFieldBlocState<
T extends FieldBloc< FieldBlocStateBase> , ExtraData> - ListGroupStyle
- ListView
- MultiBlocListener
- Merges multiple BlocListener widgets into one widget tree.
- MultiBlocObserver
-
A BlocObserver which supports registering multiple BlocObserver
instances. This is useful when maintaining multiple BlocObserver instances
for different functions e.g.
LoggingBlocObserver,ErrorReportingBlocObserver. - MultiBlocProvider
- Merges multiple BlocProvider widgets into one widget tree.
-
MultiFieldBloc<
ExtraData, TState extends MultiFieldBlocState< ExtraData> > -
MultiFieldBlocState<
ExtraData> - MultiRepositoryProvider
- Merges multiple RepositoryProvider widgets into one widget tree.
-
MultiSelectFieldBloc<
Value, ExtraData> -
A
FieldBlocused to select multiple items from multiple items. -
MultiSelectFieldBlocState<
Value, ExtraData> - ObscureSuffixButton
- ObscureSuffixButtonTheme
- The theme of ObscureSuffixButton
- RadioFieldTheme
- Theme of RadioButtonGroupFieldBlocBuilder
-
RepositoryProvider<
T> -
Takes a
createfunction that is responsible for creating the repository and achildwhich will have access to the repository viaRepositoryProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a repository can be provided to multiple widgets within a subtree. - ScrollableFormTheme
- The theme of DmScrollableFormBlocManager
-
SelectFieldBloc<
Value, ExtraData> -
A
FieldBlocused to select one item from multiple items. -
SelectFieldBlocState<
Value, ExtraData> -
SimpleMaterialStateProperty<
T> -
SingleFieldBloc<
Value, Suggestion, State extends FieldBlocState< Value, Suggestion, ExtraData> , ExtraData> - The base class with the common behavior of all single field blocs:
- SliderFieldTheme
-
StateStreamable<
State> - A Streamable that provides synchronous access to the current state.
-
StateStreamableSource<
State> - A StateStreamable that must be closed when no longer in use.
-
Streamable<
State extends Object?> - An object that provides access to a stream of states over time.
- Style
- SuffixButtonBuilderBase
- SuggestionsBoxDecoration
-
Supply an instance of this class to the
TypeAhead.suggestionsBoxDecorationproperty to configure the suggestions box decoration - SwitchFieldTheme
- Theme of SwitchFieldBlocBuilder
- TableGroupStyle
- Similar to Table without borders or GridView without scroll
-
TextFieldBloc<
ExtraData> -
A
FieldBlocused forStringtype, but generally it is also used to obtainintanddoublevalues of texts thanks to the methods valueToInt and valueToDouble. -
TextFieldBlocState<
ExtraData> - TextFieldTheme
- TextInputType
- The type of information for which to optimize the text input control.
-
Transition<
Event, State> - A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.
- ValidationStatus
- WrapChipFieldTheme
- The theme of ChoiceChipFieldBlocBuilder and FilterChipFieldBlocBuilder for the chip wrap
- WrapGroupStyle
- Wrap
Enums
- FieldBlocBuilderControlAffinity
- SuffixButton
- TextCapitalization
- Configures how the platform keyboard will select an uppercase or lowercase keyboard.
- TextInputAction
- An action the user has requested the text input control to perform.
Mixins
-
FieldBloc<
State extends FieldBlocStateBase> - The common interface of all field blocs:
- FieldBlocStateBase
- The common state interface of all field blocs
Extensions
- ReadContext on BuildContext
- Exposes the read method.
- SelectContext on BuildContext
-
Adds a
selectmethod on BuildContext. - WatchContext on BuildContext
- Exposes the watch method.
Typedefs
-
AsyncValidator<
Value> = Future< Object?> Function(Value value) -
Signature for the AsyncValidator function which takes
valueand should returns aObjecterror, and if doesn't have error should returnnull. -
BlocBuilderCondition<
S> = bool Function(S previous, S current) -
Signature for the
buildWhenfunction which takes the previousstateand the currentstateand is responsible for returning a bool which determines whether to rebuild BlocBuilder with the currentstate. -
BlocChildBuilder<
FieldBlocState> = Widget Function(BuildContext context, FieldBlocState state, Widget child) -
BlocListenerCondition<
S> = bool Function(S previous, S current) -
Signature for the
listenWhenfunction which takes the previousstateand the currentstateand is responsible for returning a bool which determines whether or not to call BlocWidgetListener of BlocListener with the currentstate. -
BlocWidgetBuilder<
S> = Widget Function(BuildContext context, S state) -
Signature for the
builderfunction which takes theBuildContextandstateand is responsible for returning a widget which is to be rendered. This is analogous to thebuilderfunction in StreamBuilder. -
BlocWidgetListener<
S> = void Function(BuildContext context, S state) -
Signature for the
listenerfunction which takes theBuildContextalong with thestateand is responsible for executing in response tostatechanges. -
BlocWidgetSelector<
S, T> = T Function(S state) -
Signature for the
selectorfunction which is responsible for returning a selected value,T, based onstate. -
ChipFieldItemBuilder<
T> = ChipFieldItem Function(BuildContext context, T value) -
DefaultFieldBlocErrorBuilder
= String? Function(BuildContext context, Object error, FieldBloc<
FieldBlocStateBase> fieldBloc) -
DmFormBlocListenerCallback<
FormBlocState extends FormBlocState< SuccessResponse, ErrorResponse> , SuccessResponse, ErrorResponse> = void Function(BuildContext context, FormBlocState state) -
EventHandler<
Event, State> = FutureOr< void> Function(Event event, Emitter<State> emit) -
An event handler is responsible for reacting to an incoming
Eventand can emit zero or more states via the Emitter. -
EventMapper<
Event> = Stream< Event> Function(Event event) - Signature for a function which converts an incoming event into an outbound stream of events. Used when defining custom EventTransformers.
-
EventTransformer<
Event> = Stream< Event> Function(Stream<Event> events, EventMapper<Event> mapper) - Used to change how events are processed. By default events are processed concurrently.
- FieldBlocErrorBuilder = String? Function(BuildContext context, Object error)
-
FieldItemBuilder<
T> = FieldItem Function(BuildContext context, T value) -
This function takes the
contextand thevalueand must return a FieldItem that represent thatvalue. -
Suggestions<
Value> = Future< List< Function(String pattern)Value> > -
Signature for the Suggestions function which takes
patternand should returns aFuturewith aList<Value>. -
Validator<
Value> = Object? Function(Value value) -
Signature for the Validator function which takes
valueand should returns aObjecterror, and if doesn't have error should returnnull.
Exceptions / Errors
- ProviderNotFoundException
-
The error that will be thrown if
Provider.offails to find aProvideras an ancestor of the BuildContext used.