BlocxFormRegisterButton<F extends BlocxBaseFormEntity<F, E>, P, E extends Enum> class

A reusable submit button that reacts to the current BlocxFormState.

Automatically handles these visual states:

  • idle: shows buttonText and submits when tapped.
  • submitting: disables the button, shows submitText, and displays loading.
  • checking unique fields: disables the button and displays loading.
  • fetching required field info: disables the button and displays loading.

Validation errors do not disable the button by default. This is intentional: the form bloc must be the final authority that validates and blocks invalid submission. This prevents FormValidationMode.onSubmit forms from getting stuck after the first failed submit.

Set BlocxFormRegisterButtonOptions.disableWhenInvalid to true if the button should be disabled when BlocxFormState.errors is not empty.

Inheritance

Constructors

BlocxFormRegisterButton({Key? key, required BlocxFormState<F, E> state, required String buttonText, required String submitText, RegisterButtonType type = RegisterButtonType.filled, BlocxFormRegisterButtonOptions buttonOptions = const BlocxFormRegisterButtonOptions(), VoidCallback? onPressed})
Creates a form register button.
const

Properties

buttonOptions BlocxFormRegisterButtonOptions
Visual and behavioral configuration for the button.
final
buttonText String
The label displayed while the form is idle.
final
hashCode int
The hash code for this object.
no setterinherited
hasValidationErrors bool
Whether the state currently contains validation errors.
no setter
isBusy bool
Whether the button should display a loading indicator.
no setter
isCheckingUniqueFields bool
Whether any unique-field checks are currently running.
no setter
isDisabled bool
Whether the button should be disabled.
no setter
isFetchingFieldInfo bool
Whether any required field information is currently being fetched.
no setter
isSubmittingForm bool
Whether the form is currently submitting.
no setter
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed VoidCallback?
Called when the button is tapped while idle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → BlocxFormState<F, E>
The current form state.
final
submitText String
The label displayed while the form is submitting.
final
type RegisterButtonType
The visual variant of the button.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
buildElevatedButton(BuildContext context, {required String label, required bool disabled}) Widget
Builds an ElevatedButton variant.
buildFilledButton(BuildContext context, {required String label, required bool disabled}) Widget
Builds a FilledButton variant.
buildOtherButton(BuildContext context, {required String label, required bool disabled}) Widget
Builds a fully custom button variant.
buildOutlinedButton(BuildContext context, {required String label, required bool disabled}) Widget
Builds an OutlinedButton variant.
buildTextButton(BuildContext context, {required String label, required bool disabled}) Widget
Builds a TextButton variant.
colorScheme(BuildContext context) ColorScheme
inherited
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
getState(BuildContext context) BlocxFormWidgetState<BlocxFormWidget<P>, F, P, E>
Retrieves the nearest ancestor BlocxFormWidgetState.
height(BuildContext context) double
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
textTheme(BuildContext context) TextTheme
inherited
theme(BuildContext context) ThemeData
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited
width(BuildContext context) double
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited