FxButton class

A customizable button widget that follows a specific design style.

The FxButton widget provides various customization options such as text, icons, colors, shapes, sizes, and more. It supports different button types like solid, outline, outline2x, and transparent. The appearance and behavior of the button can be modified using the provided properties.

Inheritance
Available Extensions

Constructors

FxButton({required String text, required VoidCallback onPressed, Key? key, Color? color = FxColor.primary, Color? outlineColor = FxColor.primary, BtnShape shape = BtnShape.rounded, BtnSize size = BtnSize.normal, BtnType type = BtnType.solid, bool isBlock = false, IconData? prefixIcon, IconData? suffixIcon, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, BorderRadius? radius, List<BoxShadow>? shadow, Color? textColor, Color? iconColor, bool isSplashColor = false, MainAxisAlignment? mainAxisAlignment, double? prefixIconSize, double? suffixIconSize, TextStyle? textStyle})
constructor
const

Properties

color Color?
The color parameter sets the button's background color for the solid button type.
final
hashCode int
The hash code for this object.
no setterinherited
iconColor Color?
The iconColor parameter sets the color for the prefix and suffix icons. If not provided, the icon color will be determined based on the button's background color.
final
isBlock bool
The isBlock parameter indicates whether the button should occupy the full width available.
final
isSplashColor bool
A boolean value indicating whether splash color is enabled for the button.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mainAxisAlignment MainAxisAlignment?
Defines how the children should be placed along the main axis.
final
margin EdgeInsetsGeometry?
The margin parameters allow customization of the button's external padding.
final
onPressed VoidCallback
The onPressed parameter is required and defines the callback function when the button is pressed.
final
outlineColor Color?
The outlineColor parameter sets the button's outline color for the outline button types.
final
padding EdgeInsetsGeometry?
The padding parameters allow customization of the button's internal padding
final
prefixIcon IconData?
The prefixIcon parameter specifies the icon to be displayed before the button text.
final
prefixIconSize double?
The prefixIconSize parameter determines the prefix icons's size, which can be one of
final
radius BorderRadius?
The radius parameter determines the button's border radius. If not provided, the default border radius will be based on the button's shape.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadow List<BoxShadow>?
The shadow parameter allows specifying a list of box shadows to create a shadow effect for the button.
final
shape BtnShape
The shape parameter specifies the button's shape, which can be one of the values in the BtnShape enum.
final
size BtnSize
The size parameter determines the button's size, which can be one of the values in the BtnSize enum.
final
suffixIcon IconData?
The suffixIcon parameter specifies the icon to be displayed after the button text.
final
suffixIconSize double?
The suffixIconSize parameter determines the suffix icon's size, which can be one of
final
text String
The text parameter is required and specifies the button's label text.
final
textColor Color?
The textColor parameter sets the text color for the solid button type. If not provided, the text color will be automatically determined based on the button's background color.
final
textStyle TextStyle?
The style to use for the button's text.
final
type BtnType
The type parameter defines the button's type, which can be one of the values in the BtnType enum.
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
getBtnShape() BorderRadius
Returns the border radius for the button based on its shape.
getBtnSize() double
Returns the size factor for the button based on its size.
getBtnType() Color
Returns the button color based on its type. If the type is BtnType.outline, BtnType.outline2x, or BtnType.transparent, returns Colors.transparent. Otherwise, returns FxColor.primary.
getButtonBorder() Border
Returns the appropriate border for the button based on its type.
getTextColor(Color color) Color
Returns the text color for the button based on the background color. If the background color is transparent, returns FxColor.gray700. Otherwise, returns FxColor.gray700 for light background colors and Colors.white for dark background colors.
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