decoration method
Widget
decoration({
- Color? color,
- DecorationImage? image,
- Gradient? gradient,
- List<
BoxShadow> ? shadows, - BoxBorder? border,
- BorderRadiusGeometry? borderRadius,
- BlendMode? backgroundBlendMode,
- BoxShape? boxShape,
- ShapeBorder? shape,
- Decoration? decoration,
- DecorationPosition position = DecorationPosition.background,
Paints a decoration either after (default) or before this widget.
Implementation
@widgetFactory
Widget decoration({
// Common parameters for all decorations
Color? color,
DecorationImage? image,
Gradient? gradient,
List<BoxShadow>? shadows,
// BoxDecoration specific parameters
BoxBorder? border,
BorderRadiusGeometry? borderRadius,
BlendMode? backgroundBlendMode,
BoxShape? boxShape,
// ShapeDecoration specific parameters
ShapeBorder? shape,
// DecoratedBox parameters
Decoration? decoration,
DecorationPosition position = DecorationPosition.background,
}) {
assert(() {
_debugCheckParameterCombinations(modifier: 'decoration', [
{
'border': border,
'borderRadius': borderRadius,
'backgroundBlendMode': backgroundBlendMode,
'boxShape': boxShape,
},
{'shape': shape}
]);
return true;
}());
if (decoration == null) {
if (shape != null) {
decoration = ShapeDecoration(
shape: shape,
color: color,
image: image,
gradient: gradient,
shadows: shadows,
);
} else {
decoration = BoxDecoration(
color: color,
image: image,
gradient: gradient,
boxShadow: shadows,
border: border,
borderRadius: borderRadius,
shape: boxShape ?? BoxShape.rectangle,
backgroundBlendMode: backgroundBlendMode,
);
}
}
return FleetDecoratedBox(
decoration: decoration,
position: position,
child: this,
);
}