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 disableWhenInvalid to true if you explicitly want the button disabled
when BlocxFormState.errors is not empty.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- BlocxStatelessWidget
- BlocxFormRegisterButton
Constructors
-
BlocxFormRegisterButton({Key? key, required BlocxFormState<
F, E> state, required String buttonText, required String submitText, required VoidCallback? onPressed, RegisterButtonType type = RegisterButtonType.filled, ButtonStyle? elevatedStyle, ButtonStyle? filledStyle, ButtonStyle? textStyle, ButtonStyle? outlinedStyle, TextStyle? labelTextStyle, WidgetBuilder? loadingIndicatorBuilder, double spacing = 8.0, ButtonStyle? style, bool disableWhenInvalid = false}) -
Creates a BlocxFormRegisterButton.
const
Properties
-
The label displayed when the form is idle.
final
- disableWhenInvalid → bool
-
Whether validation errors should disable the button.
final
- elevatedStyle → ButtonStyle?
-
Optional style applied to RegisterButtonType.elevated buttons.
final
- filledStyle → ButtonStyle?
-
Optional style applied to RegisterButtonType.filled buttons.
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 show 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 info 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
- labelTextStyle → TextStyle?
-
Optional style applied to the inner Text label.
final
- loadingIndicatorBuilder → WidgetBuilder?
-
Builds a custom loading indicator shown while submitting or checking fields.
final
- onPressed → VoidCallback?
-
Called when the button is tapped while idle.
final
- outlinedStyle → ButtonStyle?
-
Optional style applied to RegisterButtonType.outlined buttons.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spacing → double
-
Horizontal spacing between the loading indicator and the label text.
final
-
state
→ BlocxFormState<
F, E> -
The current form state.
final
- style → ButtonStyle?
-
A unified ButtonStyle that takes precedence over all per-type style
parameters.
final
- submitText → String
-
The label displayed while the form is submitting.
final
- textStyle → ButtonStyle?
-
Optional style applied to RegisterButtonType.text buttons.
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.
-
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited