Button class

A customizable button widget that can display an icon and optional text.

The Button widget allows for flexible customization of its appearance and behavior. It supports displaying an icon with optional text, which can be arranged either in a single line or across multiple lines. The icon and onPressed parameters are required. The color, center, borderRadius, text, padding, bold, and multiLine parameters are optional and have default values.

Inheritance

Constructors

Button({Key? key, required CustomIcon? icon, bool center = true, Color color = Colors.transparent, BorderRadius borderRadius = BorderRadius.zero, required VoidCallback onPressed, String? text, EdgeInsets padding = EdgeInsets.zero, bool bold = false, bool multiLine = false})
const

Properties

bold bool
Set the text to bold.
final
borderRadius BorderRadius
The border radius of the button.
final
center bool
Center the icon and text.
final
color Color
The background color of the button.
final
hashCode int
The hash code for this object.
no setterinherited
icon CustomIcon?
The icon to be displayed inside the button.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
multiLine bool
Set the button in multi-line mode. The icon will be above the text.
final
onPressed VoidCallback
The callback function to be executed when the button is pressed.
final
padding EdgeInsets
The padding inside the button.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String?
Optional text to be displayed under the icon.
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}) 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