CustomActionButton class
A customizable button widget that can be configured as elevated, flat, minimal, or long-press button types. Provides a flexible API to adjust styles, colors, shapes, and behaviors.
The CustomActionButton supports different visual styles through the ButtonType enum and offers factory constructors for convenience.
Example usage:
CustomActionButton.elevated(
onPressed: () {},
child: Text('Elevated Button'),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomActionButton
Constructors
- CustomActionButton({Key? key, required Widget child, ButtonType? buttonType, VoidCallback? onPressed, VoidCallback? onLongPress, Color? backgroundColor, Color? foregroundColor, Color? shadowColor, Color? splashColor, Color? disabledBackgroundColor, Color? disabledBorderColor, Color? borderColor, double? elevation, double? borderRadius, double? width, double? height, OutlinedBorder? shape, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, InteractiveInkFeatureFactory? splashFactory})
-
Creates a CustomActionButton with the given parameters.
const
- CustomActionButton.elevated({required VoidCallback? onPressed, required Widget child, Color? backgroundColor, Color? foregroundColor, Color? shadowColor, Color? splashColor, Color? disabledBackgroundColor, Color? disabledForegroundColor, Color? borderColor, double elevation = 2.0, double borderRadius = 8.0, BorderSide? side, OutlinedBorder? shape, double? width, double? height, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, InteractiveInkFeatureFactory? splashFactory})
-
Creates an elevated button.
factory
- CustomActionButton.flat({required VoidCallback? onPressed, required Widget child, Color? backgroundColor, Color? foregroundColor, Color? splashColor, Color? disabledBackgroundColor, Color? disabledForegroundColor, Color? borderColor, double borderRadius = 8.0, BorderSide? side, OutlinedBorder? shape, double? width, double? height, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, InteractiveInkFeatureFactory? splashFactory})
-
Creates a flat button.
factory
- CustomActionButton.longPress({required VoidCallback? onPressed, required VoidCallback? onLongPress, required Widget child, Color? backgroundColor, Color? foregroundColor, Color? shadowColor, Color? splashColor, Color? disabledBackgroundColor, Color? disabledForegroundColor, Color? borderColor, double elevation = 2.0, double borderRadius = 8.0, BorderSide? side, OutlinedBorder? shape, double? width, double? height, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, InteractiveInkFeatureFactory? splashFactory})
-
Creates a long-press button.
factory
- CustomActionButton.minimal({required VoidCallback? onPressed, required Widget child, Color? foregroundColor, Color? disabledForegroundColor, Color? borderColor, double? width, double? height, OutlinedBorder? shape, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin})
-
Creates a minimal button.
factory
Properties
- backgroundColor → Color?
-
The background color of the button.
final
- borderColor → Color?
-
The border color of the button.
final
- borderRadius → double?
-
The border radius of the button.
final
-
The type of button to display.
final
- child → Widget
-
The child widget to display inside the button.
final
- disabledBackgroundColor → Color?
-
The background color of the button when it is disabled.
final
- disabledBorderColor → Color?
-
The border color of the button when it is disabled.
final
- elevation → double?
-
The elevation of the button.
final
- foregroundColor → Color?
-
The foreground color (text/icon color) of the button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The height of the button.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry?
-
The external margin around the button.
final
- onLongPress → VoidCallback?
-
The callback that is called when the button is long-pressed.
Only used when buttonType is ButtonType.longPress.
final
- onPressed → VoidCallback?
-
The callback that is called when the button is tapped.
final
- padding → EdgeInsetsGeometry?
-
The amount of space to surround the child inside the button.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowColor → Color?
-
The shadow color of the button.
final
- shape → OutlinedBorder?
-
The shape of the button's material.
final
- splashColor → Color?
-
The splash color of the button when tapped.
final
- splashFactory → InteractiveInkFeatureFactory?
-
The splash factory to define interaction effects.
final
- width → double?
-
The width of the button.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomActionButton> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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