CoderButton class
A highly customizable button widget with optional loading state, icon, padding, border radius, and style overrides.
Example usage:
CoderButton(
text: 'Submit',
onPressed: () => print('Submitted!'),
icon: Icon(Icons.send),
isLoading: false,
backgroundColor: Colors.blue,
textColor: Colors.white,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CoderButton
Constructors
- CoderButton({Key? key, required String text, required dynamic onPressed()?, Color? backgroundColor, Color? textColor, double? height, double? width, double? radius, BorderRadius? borderRadius, double? paddingH, double? paddingV, TextStyle? style, bool isLoading = false, Widget? icon})
-
Creates a CoderButton with customizable design and state.
const
Properties
- backgroundColor → Color?
-
Optional background color of the button. Defaults to
colorAccent.final - borderRadius → BorderRadius?
-
Full border radius. Takes priority over radius if set.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the button. Defaults to
context.scale(48).final - icon → Widget?
-
Optional icon shown before the text.
final
- isLoading → bool
-
Whether to show a loading spinner instead of content.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onPressed → dynamic Function()?
-
Callback when the button is tapped.
final
- paddingH → double?
-
Horizontal padding inside the button content.
final
- paddingV → double?
-
Vertical padding inside the button content.
final
- radius → double?
-
Circular radius if borderRadius is not provided.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → TextStyle?
-
Text style override.
final
- text → String
-
Button label text (required).
final
- textColor → Color?
-
Optional text color. Defaults to
colorAccentText.final - width → double?
-
Width of the button. If null, button expands based on content.
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