ThemedButton class

Inheritance

Constructors

ThemedButton({Key? key, Widget? label, String? labelText, IconData? icon, VoidCallback? onTap, bool isLoading = false, Color? color, ThemedButtonStyle style = ThemedButtonStyle.filledTonal, bool isCooldown = false, Duration cooldownDuration = const Duration(seconds: 5), VoidCallback? onCooldownFinish, String? hintText, double? width, bool isDisabled = false, ThemedTooltipPosition tooltipPosition = ThemedTooltipPosition.bottom, double fontSize = 13, bool tooltipEnabled = true, bool showCooldownRemainingDuration = true})
ThemedButton is a widget that displays a button with a custom label.
const
ThemedButton.cancel({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory
ThemedButton.delete({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory
ThemedButton.edit({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory
ThemedButton.info({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory
ThemedButton.save({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory
ThemedButton.show({bool isMobile = false, required VoidCallback onTap, required String labelText, bool isLoading = false, bool isDisabled = false, bool isCooldown = false, VoidCallback? onCooldownFinish})
factory

Properties

color Color?
color is used to override the color of the button. By default, the color will be Theme.of(context).primaryColor.
final
cooldownDuration Duration
cooldownDuration is used to set the duration of the cooldown.
final
fontSize double
fontSize is used to set the font size of the label. By default, will use 13.
final
hashCode int
The hash code for this object.
no setterinherited
hintText String?
hintText is the hint text of the button, will display as tooltip. This property only will appear when the button is style as any non-FAB style (ThemedButtonStyle.text, ThemedButtonStyle.outlined, ThemedButtonStyle.filled, ThemedButtonStyle.filledTonal or ThemedButtonStyle.elevated).
final
icon IconData?
icon is the icon of the button, when style is any FAB style, will only shows the icon and use the labelText as tooltip. In case that you use label instead of labelText, the tooltip will be the content of the label.
final
isCooldown bool
Information about of the cooldown indicator. isCooldown indicates to the widget when the cooldown was started. cooldown indicates the duration of the cooldown, by default, will use 5 seconds duration. onCooldownFinish will be called when the cooldown is finished.
final
isDisabled bool
isDisabled is used to disable the button.
final
isLoading bool
isLoading is used to show a loading indicator.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label Widget?
label and labelText is the label of the button. Cannot provide both.
final
labelText String?
labelText is for send only the String and assume the component will adapt the colors and related things automatically.
final
onCooldownFinish VoidCallback?
onCooldownFinish will be called when the cooldown is finished. Take care about this callback, because it will be called every time when the cooldown is finished. To prevent excesive setState or something like that in your app, we recommend to use this callback in one of the buttons presents in the screen.
final
onTap VoidCallback?
onTap is called when the button is tapped.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCooldownRemainingDuration bool
showCooldownRemainingDuration if false the text counting down the cooldown will not be shown.
final
style ThemedButtonStyle
style is the design of the button, based on Material 3 rules. For more info go to https://m3.material.io/components/all-buttons.
final
tooltipEnabled bool
tooltipEnabled is used to enable/disable the tooltip. By default, will use true.
final
tooltipPosition ThemedTooltipPosition
tooltipPosition is used to set the position of the tooltip. By default, will use ThemedTooltipPosition.bottom.
final
width double?
width is the width of the button. If this property is null, the width will be calculated based on the content of the button.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ThemedButton>
Creates the mutable state for this widget at a given location in the tree.
override
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

Static Properties

height double
height is used to know the height of the button.
no setter

Static Methods

getDisabledColor(bool isDark, ThemedButtonStyle style) Color
disabledColor is used to know the color of the disabled button.