ShadButtonTheme class

The theme for ShadButton.

Use this class to override some properties to all buttons in just one place.

Annotations

Constructors

ShadButtonTheme({bool canMerge = true, MouseCursor? cursor, ShadButtonSize? size, ShadButtonSizesTheme? sizesTheme, Color? backgroundColor, Color? hoverBackgroundColor, Color? foregroundColor, Color? hoverForegroundColor, Color? pressedBackgroundColor, Color? pressedForegroundColor, List<BoxShadow>? shadows, Gradient? gradient, TextDecoration? textDecoration, TextDecoration? hoverTextDecoration, ShadDecoration? decoration, double? width, double? height, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, Duration? longPressDuration, ShadHoverStrategies? hoverStrategies, TextDirection? textDirection, double? gap, bool? expands, TextStyle? textStyle})
const

Properties

backgroundColor Color?
The background color of the button when not hovered or pressed, overriding the theme default if provided. Changes based on variant if not explicitly set.
final
canMerge bool
no setter
crossAxisAlignment CrossAxisAlignment?
The cross axis alignment of the button's content within its Row. Defaults to CrossAxisAlignment.center if not specified.
final
cursor MouseCursor?
The mouse cursor displayed over the button, overriding the theme default if specified. Typically SystemMouseCursors.click when enabled.
final
decoration ShadDecoration?
Custom decoration for the button, merged with theme defaults if provided. Allows advanced styling beyond basic colors and shadows.
final
expands bool?
Whether the child expands to fill available space along the main axis. Defaults to false if not specified.
final
foregroundColor Color?
The color of the button's content (e.g., text, icons) when not hovered or pressed. Overrides the theme default if provided; required in theme if not set.
final
gap double?
The gap between the button's items (e.g., leading, child, trailing). Defaults to 8 pixels if not specified.
final
gradient Gradient?
The gradient applied to the button's background, overriding the theme default if provided. Supersedes backgroundColor if both are set.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The explicit minimum height of the button, overriding size-based defaults. If null, it falls back to theme or size-specific minimums. When set to 0, or a value smaller than the child's height the button's height will be determined by its child.
final
hoverBackgroundColor Color?
The background color of the button when hovered, overriding the theme default if provided. Applied during mouse hover for visual feedback.
final
hoverForegroundColor Color?
The color of the button's content when hovered, overriding the theme default if provided. Applied during mouse hover for visual feedback.
final
hoverStrategies ShadHoverStrategies?
The strategies for handling hover behavior, overriding the theme default if provided. Controls how hover states are detected and applied.
final
hoverTextDecoration TextDecoration?
The text decoration applied to the button's text when hovered, overriding the theme default if provided. Applied during mouse hover for visual feedback.
final
longPressDuration Duration?
The duration required to trigger a long press, overriding the theme default if provided. Controls the timing of onLongPress and related callbacks.
final
mainAxisAlignment MainAxisAlignment?
The main axis alignment of the button's content within its Row. Defaults to MainAxisAlignment.center if not specified.
final
pressedBackgroundColor Color?
The background color of the button when pressed, overriding the theme default if provided. Applied during tap or long-press interactions.
final
pressedForegroundColor Color?
The foreground color of the button when pressed, overriding the theme default if provided. Applied to content during tap or long-press interactions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadows List<BoxShadow>?
The list of box shadows applied to the button, overriding the theme default if provided. Enhances visual depth and elevation.
final
size ShadButtonSize?
The size of the button, one of ShadButtonSize options (regular, sm, lg). Affects dimensions and padding unless overridden by width, height, or padding.
final
sizesTheme ShadButtonSizesTheme?
The theme for the predefined sizes of ShadButton.
final
textDecoration TextDecoration?
The text decoration applied to the button's text when not hovered, overriding the theme default if provided. E.g., TextDecoration.underline for styling.
final
textDirection TextDirection?
The text direction for the button's content, overriding the default if specified. Can be set to TextDirection.ltr or TextDirection.rtl.
final
textStyle TextStyle?
The text style applied to the button's child when it is a Text widget, overriding the theme default if provided. Allows customization of font size, weight, and other text properties.
final
width double?
The explicit minimum width of the button, overriding size-based defaults. If null, it falls back to theme or size-specific minimums. When set to 0, or a value smaller than the child's width the button's width will be determined by its child.
final

Methods

copyWith({MouseCursor? cursor, ShadButtonSize? size, ShadButtonSizesTheme? sizesTheme, Color? backgroundColor, Color? hoverBackgroundColor, Color? foregroundColor, Color? hoverForegroundColor, Color? pressedBackgroundColor, Color? pressedForegroundColor, List<BoxShadow>? shadows, Gradient? gradient, TextDecoration? textDecoration, TextDecoration? hoverTextDecoration, ShadDecoration? decoration, double? width, double? height, Duration? longPressDuration, ShadHoverStrategies? hoverStrategies, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, TextDirection? textDirection, double? gap, bool? expands, TextStyle? textStyle}) ShadButtonTheme
inherited
merge(ShadButtonTheme? other) ShadButtonTheme
inherited
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.
inherited

Static Methods

lerp(ShadButtonTheme? a, ShadButtonTheme? b, double t) ShadButtonTheme?