AstryxButtonTheme class
Visual configuration for AstryxButton and AstryxIconButton.
States are discrete named fields — backgroundColor,
hoverBackgroundColor, pressedBackgroundColor — rather than a single
WidgetStateProperty. A consumer overriding one state should not have to
restate the others, and a resolver-valued field forces exactly that.
flutter_shadcn_ui reached the same conclusion.
Every field is nullable; null means "fall through to the token default".
{@tool snippet}
// Square off every button, leaving its colours alone.
const AstryxButtonTheme(borderRadius: BorderRadius.zero);
{@end-tool}
- Annotations
Constructors
-
AstryxButtonTheme({Color? backgroundColor, Color? hoverBackgroundColor, Color? pressedBackgroundColor, Color? foregroundColor, BorderSide? border, BorderRadiusGeometry? borderRadius, EdgeInsetsGeometry? padding, double? gap, TextStyle? textStyle, double? height, double? iconSize, List<
AstryxShadow> ? shadows, double? disabledOpacity, double? pressedScale, MouseCursor? mouseCursor, MouseCursor? disabledMouseCursor}) -
Creates a button theme.
const
Properties
- backgroundColor → Color?
-
The resting background.
final
- border → BorderSide?
-
The border.
final
- borderRadius → BorderRadiusGeometry?
-
The corner radius. Defaults to
--radius-element.final - disabledMouseCursor → MouseCursor?
-
The cursor over a disabled button.
final
- disabledOpacity → double?
-
The opacity applied when disabled. Upstream uses 0.5.
final
- foregroundColor → Color?
-
The label and icon colour.
final
- gap → double?
-
The gap between the leading icon, label and trailing content.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- height → double?
-
The control height, overriding the size's own.
final
- hoverBackgroundColor → Color?
-
The background while a pointer is over the button.
final
- iconSize → double?
-
The leading and trailing icon size.
final
- mouseCursor → MouseCursor?
-
The cursor over an enabled button.
final
- padding → EdgeInsetsGeometry?
-
The inline padding either side of the label.
final
- pressedBackgroundColor → Color?
-
The background while the button is pressed.
final
- pressedScale → double?
-
The scale applied while pressed. Upstream uses 0.98.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shadows
→ List<
AstryxShadow> ? -
The resting shadow.
final
- textStyle → TextStyle?
-
The label's text style.
final
Methods
-
copyWith(
{Color? backgroundColor, Color? hoverBackgroundColor, Color? pressedBackgroundColor, Color? foregroundColor, BorderSide? border, BorderRadiusGeometry? borderRadius, EdgeInsetsGeometry? padding, double? gap, TextStyle? textStyle, double? height, double? iconSize, List< AstryxShadow> ? shadows, double? disabledOpacity, double? pressedScale, MouseCursor? mouseCursor, MouseCursor? disabledMouseCursor}) → AstryxButtonTheme - Returns a copy with the given fields replaced.
-
merge(
AstryxButtonTheme? other) → AstryxButtonTheme -
Returns a copy with every non-null field of
otherapplied over this. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
lerp(
AstryxButtonTheme? a, AstryxButtonTheme? b, double t) → AstryxButtonTheme? - Linearly interpolates between two button themes.