AppButton class
A customizable, reusable button widget for Flutter apps.
The AppButton supports gradient backgrounds, shadows, icons, loading states, and disabled modes. It automatically adapts to your theme's primary color when no custom color is provided.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AppButton
Constructors
-
AppButton({Key? key, required Widget text, double? width, double? height, Color? color, Color? textColor, double? borderRadius, double? fontSize, FontWeight? fontWeight, VoidCallback? onTap, BoxBorder? border, List<
BoxShadow> ? boxShadow, Widget? prefixIcon, Widget? suffixIcon, Gradient? gradient, bool isLoading = false, bool isDisabled = false}) -
Creates a new AppButton.
const
Properties
- border → BoxBorder?
-
An optional border for the button.
final
- borderRadius → double?
-
The border radius applied to the button container.
final
-
boxShadow
→ List<
BoxShadow> ? -
Shadow(s) applied to the button container.
final
- color → Color?
-
The solid background color of the button.
final
- fontSize → double?
-
The font size of the text if using a plain string.
final
- fontWeight → FontWeight?
-
The font weight of the button text.
final
- gradient → Gradient?
-
Gradient background for the button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The button height. Defaults to
50.0.final - isDisabled → bool
-
Whether the button is disabled.
final
- isLoading → bool
-
Whether to show a loading spinner instead of text.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → VoidCallback?
-
The callback triggered when the button is tapped.
final
- prefixIcon → Widget?
-
Optional icon displayed before the button text.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- suffixIcon → Widget?
-
Optional icon displayed after the button text.
final
- text → Widget
-
The child widget or label displayed inside the button.
final
- textColor → Color?
-
The text color used for the button label.
final
- width → double?
-
The button width. Defaults to double.infinity.
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