AdwButton class

AdwButton is a widget used as a base to build Adwaita-style widgets with pressed and hover properties.

Widgets that use AdwButton as their base can rebuild their background through the backgroundColorBuilder callback.

Inheritance

Constructors

AdwButton({Key? key, EdgeInsetsGeometry padding = defaultButtonPadding, EdgeInsetsGeometry margin = EdgeInsets.zero, AdwButtonWidgetBuilder? builder, Widget? child, TextStyle? textStyle, VoidCallback? onPressed, bool opaque = false, Color? backgroundColor, AdwButtonColorBuilder? backgroundColorBuilder = defaultBackgroundColorBuilder, BoxConstraints? constraints = defaultButtonConstrains, BorderRadius? borderRadius = const BorderRadius.all(Radius.circular(6)), BoxBorder? border, BoxShape shape = BoxShape.rectangle, List<BoxShadow>? boxShadow, Duration animationDuration = const Duration(milliseconds: 200), Curve animationCurve = Curves.easeOutQuad, bool isActive = false})
const
AdwButton.circular({Key? key, double size = 34, EdgeInsetsGeometry padding = EdgeInsets.zero, EdgeInsetsGeometry margin = EdgeInsets.zero, AdwButtonWidgetBuilder? builder, Widget? child, TextStyle? textStyle, VoidCallback? onPressed, bool opaque = false, Color? backgroundColor, AdwButtonColorBuilder? backgroundColorBuilder = defaultBackgroundColorBuilder, BoxBorder? border, List<BoxShadow>? boxShadow, Duration animationDuration = const Duration(milliseconds: 200), Curve animationCurve = Curves.easeOutQuad, bool isActive = false})
AdwButton.flat({Key? key, EdgeInsetsGeometry padding = defaultButtonPadding, EdgeInsetsGeometry margin = EdgeInsets.zero, AdwButtonWidgetBuilder? builder, Widget? child, TextStyle? textStyle, VoidCallback? onPressed, Color? backgroundColor, AdwButtonColorBuilder? backgroundColorBuilder = flatBackgroundColorBuilder, BoxConstraints? constraints = defaultButtonConstrains, BorderRadius? borderRadius = const BorderRadius.all(Radius.circular(6)), BoxBorder? border, BoxShape shape = BoxShape.rectangle, List<BoxShadow>? boxShadow, Duration animationDuration = const Duration(milliseconds: 200), Curve animationCurve = Curves.easeOutQuad, bool isActive = false})
const
AdwButton.pill({Key? key, EdgeInsetsGeometry padding = const EdgeInsets.symmetric(vertical: 10, horizontal: 32), EdgeInsetsGeometry margin = EdgeInsets.zero, AdwButtonWidgetBuilder? builder, Widget? child, TextStyle? textStyle, VoidCallback? onPressed, bool opaque = false, Color? backgroundColor, AdwButtonColorBuilder? backgroundColorBuilder = defaultBackgroundColorBuilder, BoxConstraints? constraints = defaultButtonConstrains, BoxBorder? border, List<BoxShadow>? boxShadow, Duration animationDuration = const Duration(milliseconds: 200), Curve animationCurve = Curves.easeOutQuad, bool isActive = false})
const

Properties

animationCurve Curve
The curve to apply when animating the parameters of this container.
final
animationDuration Duration
The duration over which to animate the parameters of this container.
final
backgroundColor Color?
The backgroundColor of the AdwButton. This is then passed to backgroundColorBuilder to build this button for different AdwButtonStatus
final
backgroundColorBuilder AdwButtonColorBuilder?
Builder function used to create the background color of the button widget.
final
border BoxBorder?
A border to draw above the background color.
final
borderRadius BorderRadius?
If non-null, the corners of this box are rounded by this BorderRadius.
final
boxShadow List<BoxShadow>?
A list of shadows cast by this box behind the box.
final
builder AdwButtonWidgetBuilder?
Builder function used to create the child widget inside the button widget.
final
child Widget?
Widget that will be rendered inside this button.
final
constraints BoxConstraints?
Additional constraints to apply to the child.
final
hashCode int
The hash code for this object.
no setterinherited
isActive bool
Status flag to denote that the widget is active. Usually for popup buttons.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry
Empty space to surround the BoxDecoration and child.
final
onPressed VoidCallback?
Action to perform when the widget is tapped.
final
opaque bool
Whether the AdwButton has some tranparaceny or is it fully opaque
final
padding EdgeInsetsGeometry
Empty space to inscribe inside the BoxDecoration. The child, if any, is placed inside this padding.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape BoxShape
The shape to fill the background color into and to cast as the boxShadow.
final
textStyle TextStyle?
Default text style applied to the child widget.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
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 Methods

defaultBackgroundColorBuilder(BuildContext context, Color? backgroundColor, AdwButtonStatus status, {bool opaque = false}) Color?
flatBackgroundColorBuilder(BuildContext context, Color? backgroundColor, AdwButtonStatus status, {bool opaque = false}) Color?