UIProLoadingButton class
A theme-aware button with built-in loading state support.
UIProLoadingButton automatically adapts to theme changes and provides a smooth loading animation without requiring external state management.
Example:
UIProLoadingButton(
text: "Login",
isLoading: isLoading,
onPressed: () => handleLogin(),
)
With custom styling:
UIProLoadingButton(
text: "Submit",
isLoading: false,
onPressed: () {},
backgroundColor: Colors.green,
textColor: Colors.white,
borderRadius: 8,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- UIProLoadingButton
Constructors
- UIProLoadingButton({Key? key, required String text, bool isLoading = false, VoidCallback? onPressed, Color? backgroundColor, Color? textColor, Color? disabledBackgroundColor, Color? disabledTextColor, double? borderRadius, double? height, double? width, bool fullWidth = true, EdgeInsets? padding, double? elevation, TextStyle? textStyle, Widget? leading, Widget? trailing, double loadingIndicatorSize = 20, Color? loadingIndicatorColor, double loadingIndicatorStrokeWidth = 2.5, Widget? loadingWidget, BorderSide? borderSide, UIProButtonVariant variant = UIProButtonVariant.filled, bool animateStateChanges = true, Color? splashColor})
-
Creates a loading-aware button.
const
- UIProLoadingButton.filled({Key? key, required String text, bool isLoading = false, VoidCallback? onPressed, Color? backgroundColor, Color? textColor, Color? disabledBackgroundColor, Color? disabledTextColor, double? borderRadius, double? height, double? width, bool fullWidth = true, EdgeInsets? padding, double? elevation, TextStyle? textStyle, Widget? leading, Widget? trailing, double loadingIndicatorSize = 20, Color? loadingIndicatorColor, double loadingIndicatorStrokeWidth = 2.5, Widget? loadingWidget, bool animateStateChanges = true, Color? splashColor})
-
Creates a filled button (default).
const
- UIProLoadingButton.outlined({Key? key, required String text, bool isLoading = false, VoidCallback? onPressed, Color? backgroundColor, Color? textColor, Color? disabledBackgroundColor, Color? disabledTextColor, double? borderRadius, double? height, double? width, bool fullWidth = true, EdgeInsets? padding, double? elevation = 0, TextStyle? textStyle, Widget? leading, Widget? trailing, double loadingIndicatorSize = 20, Color? loadingIndicatorColor, double loadingIndicatorStrokeWidth = 2.5, Widget? loadingWidget, BorderSide? borderSide, bool animateStateChanges = true, Color? splashColor})
-
Creates an outlined button.
const
- UIProLoadingButton.text({Key? key, required String text, bool isLoading = false, VoidCallback? onPressed, Color? textColor, Color? disabledTextColor, double? borderRadius, double? height, double? width, bool fullWidth = false, EdgeInsets? padding, TextStyle? textStyle, Widget? leading, Widget? trailing, double loadingIndicatorSize = 20, Color? loadingIndicatorColor, double loadingIndicatorStrokeWidth = 2.5, Widget? loadingWidget, bool animateStateChanges = true, Color? splashColor})
-
Creates a text-only button.
const
Properties
- animateStateChanges → bool
-
Whether to animate between states.
final
- backgroundColor → Color?
-
Custom background color (overrides theme).
final
- borderRadius → double?
-
Custom border radius (overrides theme).
final
- borderSide → BorderSide?
-
Border side for outlined variant.
final
- disabledBackgroundColor → Color?
-
Custom disabled background color.
final
- disabledTextColor → Color?
-
Custom disabled text color.
final
- elevation → double?
-
Custom elevation (overrides theme).
final
- fullWidth → bool
-
Whether the button should expand to full width.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Custom button height (overrides theme).
final
- isLoading → bool
-
Whether the button is in loading state.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
Custom icon to show before text.
final
- loadingIndicatorColor → Color?
-
Color of the loading indicator.
final
- loadingIndicatorSize → double
-
Size of the loading indicator.
final
- loadingIndicatorStrokeWidth → double
-
Loading indicator stroke width.
final
- loadingWidget → Widget?
-
Custom loading widget (replaces default indicator).
final
- onPressed → VoidCallback?
-
Called when the button is pressed.
If null, the button is disabled.
final
- padding → EdgeInsets?
-
Custom padding (overrides theme).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- splashColor → Color?
-
Splash color when button is tapped.
Defaults to Colors.transparent (no splash effect).
final
- text → String
-
The button text.
final
- textColor → Color?
-
Custom text color (overrides theme).
final
- textStyle → TextStyle?
-
Custom text style (merged with theme).
final
- trailing → Widget?
-
Custom icon to show after text.
final
- variant → UIProButtonVariant
-
Button variant style.
final
- width → double?
-
Custom button width. If null, takes available width.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
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