BoxDecoration class final
Defines the visual decoration style (background and borders) for a box.
Consists of an optional background style, background color, and an optional Border. It also supports linear color gradients on the borders using borderStartColor, borderEndColor, and borderGradientAngle.
Example Usage
const decoration = BoxDecoration(
backgroundStyle: Style(background: Color(0xFF0000FF)),
border: Border.rounded,
borderStartColor: Color(0, 240, 200), // Teal start
borderEndColor: Color(180, 40, 250), // Purple end
borderGradientAngle: 0.785, // ~45 degrees diagonal gradient
);
Properties
| Property | Type | Description |
|---|---|---|
backgroundStyle |
Style? | The style (e.g. color) used to paint background cells. |
backgroundColor |
Color? | The background color. |
border |
Border? | The border style configuration. |
borderStartColor |
Color? | The starting color of the border gradient. |
borderEndColor |
Color? | The ending color of the border gradient. |
borderGradientAngle |
double | The angle of the border gradient in radians (defaults to 0.0). |
Constructors
- BoxDecoration({Style? backgroundStyle, Color? backgroundColor, Border? border, Color? borderStartColor, Color? borderEndColor, double borderGradientAngle = 0.0})
-
Creates a new BoxDecoration.
const
Properties
- backgroundColor → Color?
-
The background color.
final
- backgroundStyle → Style?
-
The style used to paint the background.
final
- border → Border?
-
The border configuration.
final
- borderEndColor → Color?
-
Ending color for horizontal border gradients.
final
- borderGradientAngle → double
-
The angle of the border gradient in radians (defaults to 0.0, horizontal).
final
- borderStartColor → Color?
-
Starting color for horizontal border gradients.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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