AuiIconButton class

A customizable icon button widget for Flutter.

This widget combines a text button with an icon. It allows customization of button width, background color, border radius, item gap, icon properties (icon data, size, weight, color), text style, and onPressed callback.

To use this widget, simply instantiate it and provide the desired parameters.

Example:

AuiIconButton(
          borderRadius: ButtonRadiusType.medium,
         backgroundColor: Colors.blue,
          itemGap: 15,
          icon: Icons.star,
          iconSize: 40,
          iconWeight: 3,
          iconColor: Colors.yellow,
          textStyle: TextStyle(color: Colors.white),
          onPressed: () {
            print('Icon button pressed!');
          },
        ),

The borderRadius parameter specifies the corner radius of the button. It accepts values from the ButtonRadiusType enum: none, small, medium, large, and extraLarge. If no value is provided, the default radius is 0.

The backgroundColor parameter sets the background color of the button. The default color is Colors.yellow.

The itemGap parameter specifies the space between the icon and text inside the button. The default value is 10.

The icon parameter sets the icon data to be displayed in the button. The default icon is Icons.send_rounded.

The iconSize parameter sets the size of the icon. The default size is 30.

The iconWeight parameter sets the weight of the icon. The default weight is 5.

The iconColor parameter sets the color of the icon. The default color is Colors.deepPurple.

The textStyle parameter allows custom styling for the button text. If no value is provided, a default text style will be used.

The onPressed callback is triggered when the button is pressed. If no callback is provided, the button will be disabled.

See also:

  • ButtonRadiusType, an enum defining different border radius types.
  • TextButton, a Flutter widget for displaying a text button.
  • Icon, a Flutter widget for displaying an icon.
Inheritance

Constructors

AuiIconButton({Key? key, ButtonRadiusType? borderRadius, Color? iconColor = Colors.deepPurple, Color backgroundColor = Colors.yellow, double itemGap = 10, TextStyle? textStyle, double iconWeight = 5, double iconSize = 30, IconData icon = Icons.send_rounded, double buttonWidth = 500, void onPressed()?, double? iconWidth})
const

Properties

backgroundColor Color
The background color of the button.
final
borderRadius ButtonRadiusType?
The border radius of the button, customizable with the ButtonRadiusType enum.
final
buttonWidth double
The width of the button.
final
hashCode int
The hash code for this object.
no setterinherited
icon IconData
The icon displayed within the button.
final
iconColor Color?
The color of the icon, if specified. Defaults to a standard color if left null.
final
iconSize double
The size of the icon within the button.
final
iconWeight double
The weight or thickness of the icon, affecting its visual boldness.
final
iconWidth double?
The width of the icon, if specified. Allows for flexible icon sizing within the button.
final
itemGap double
The gap between each item in a layout or container.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed → void Function()?
The callback function triggered when the button is pressed. If left null, the button will not respond to user interaction.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textStyle TextStyle?
The text style for any text displayed within the button. This allows customization of font size, weight, color, and more.
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
getRadius() double
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