ComponentThemeButtonStyle<T extends ButtonTheme> class
Theme-aware button style that integrates with the component theme system.
ComponentThemeButtonStyle implements AbstractButtonStyle and provides automatic theme integration by looking up theme overrides from the widget tree's ComponentTheme. If a theme override is found, it's applied; otherwise, the fallback style is used.
This enables global button style customization through the theme system while maintaining type-safe access to specific button theme types.
Example:
const ComponentThemeButtonStyle<PrimaryButtonTheme>(
fallback: ButtonVariance.primary,
)
- Implemented types
- Available extensions
Constructors
- ComponentThemeButtonStyle({required AbstractButtonStyle fallback})
-
Creates a ComponentThemeButtonStyle with the specified fallback style.
const
Properties
-
decoration
→ ButtonStateProperty<
Decoration> -
Returns the decoration (background, border, shadows) based on button state.
no setteroverride
- fallback → AbstractButtonStyle
-
The fallback style used when no theme override is found.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
iconTheme
→ ButtonStateProperty<
IconThemeData> -
Returns the icon theme based on button state.
no setteroverride
-
margin
→ ButtonStateProperty<
EdgeInsetsGeometry> -
Returns the external margin based on button state.
no setteroverride
-
mouseCursor
→ ButtonStateProperty<
MouseCursor> -
Returns the mouse cursor appearance based on button state.
no setteroverride
-
padding
→ ButtonStateProperty<
EdgeInsetsGeometry> -
Returns the internal padding based on button state.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
textStyle
→ ButtonStateProperty<
TextStyle> -
Returns the text style based on button state.
no setteroverride
Methods
-
copyWith(
{ButtonStatePropertyDelegate< Decoration> ? decoration, ButtonStatePropertyDelegate<MouseCursor> ? mouseCursor, ButtonStatePropertyDelegate<EdgeInsetsGeometry> ? padding, ButtonStatePropertyDelegate<TextStyle> ? textStyle, ButtonStatePropertyDelegate<IconThemeData> ? iconTheme, ButtonStatePropertyDelegate<EdgeInsetsGeometry> ? margin}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy of this style with selectively replaced properties. -
find(
BuildContext context) → T? -
Looks up the button theme of type
Tfrom the component theme. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withBackgroundColor(
{Color? color, Color? hoverColor, Color? focusColor, Color? disabledColor}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy with custom background colors for different states. -
withBorder(
{Border? border, Border? hoverBorder, Border? focusBorder, Border? disabledBorder}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy with custom borders for different states. -
withBorderRadius(
{BorderRadiusGeometry? borderRadius, BorderRadiusGeometry? hoverBorderRadius, BorderRadiusGeometry? focusBorderRadius, BorderRadiusGeometry? disabledBorderRadius}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy with custom border radius for different states. -
withForegroundColor(
{Color? color, Color? hoverColor, Color? focusColor, Color? disabledColor}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy with custom foreground colors for different states. -
withPadding(
{EdgeInsetsGeometry? padding, EdgeInsetsGeometry? hoverPadding, EdgeInsetsGeometry? focusPadding, EdgeInsetsGeometry? disabledPadding}) → AbstractButtonStyle -
Available on AbstractButtonStyle, provided by the ButtonStyleExtension extension
Creates a copy with custom padding for different states.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited