ButtonStyle class
The ButtonStyle class defines the visual appearance and behavior of buttons in the Flint UI framework.
It specifies attributes like backgroundColor, textStyle, border, and hoverColor, allowing for consistent and reusable button designs across multiple UI components.
Predefined styles such as ButtonStyle.primary, ButtonStyle.success, and ButtonStyle.outline provide quick access to commonly used button types.
Example:
final primary = ButtonStyle.primary();
final custom = ButtonStyle(
backgroundColor: '#1d72b8',
textStyle: TextStyle(
color: '#ffffff',
fontWeight: FontWeight.w600,
fontSize: 16,
),
hoverColor: '#155d8a',
);
Constructors
- ButtonStyle({required String backgroundColor, String? disabledColor, TextStyle textStyle = const TextStyle(), BoxBorder? border, String hoverColor = '#0056b3'})
-
Creates a custom ButtonStyle.
const
- ButtonStyle.danger()
- A predefined danger button style.
- ButtonStyle.ghost()
- A predefined ghost button style.
- ButtonStyle.outline()
- A predefined outline button style.
- ButtonStyle.primary()
- A predefined primary button style.
- ButtonStyle.secondary()
- A predefined secondary button style.
- ButtonStyle.success()
- A predefined success button style.
- ButtonStyle.warning()
- A predefined warning button style.
Properties
- backgroundColor → String
-
The main background color of the button.
final
- border → BoxBorder?
-
The border surrounding the button, if any.
final
- disabledColor → String?
-
The background color of the button when it is disabled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hoverColor → String
-
The background color of the button when hovered (on web or interactive UI).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyle → TextStyle
-
The text style applied to the button's label.
final
Methods
-
copyWith(
{String? backgroundColor, String? disabledColor, TextStyle? textStyle, BoxBorder? border, String? hoverColor}) → ButtonStyle - Returns a new ButtonStyle instance with selectively updated properties.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this style into a serializable JSON representation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited