toDecoratedBox method
Widget
toDecoratedBox({
- Color? bgColor,
- ImageProvider<
Object> ? bgImage, - BoxShape? boxShape,
- BorderRadius? borderRadius,
- Border? border,
- bool? inFrontOfChild,
- bool? hasShadow,
create a decorated container (without size altered)
Implementation
Widget toDecoratedBox({
Color? bgColor,
ImageProvider<Object>? bgImage,
BoxShape? boxShape,
BorderRadius? borderRadius,
Border? border,
bool? inFrontOfChild,
bool? hasShadow,
}) =>
DecoratedBox(
decoration: BoxDecoration(
color: bgColor,
image: bgImage != null ? DecorationImage(image: bgImage, fit: BoxFit.cover) : null,
shape: boxShape ?? BoxShape.rectangle,
borderRadius: borderRadius,
border: border,
boxShadow: (hasShadow ?? false)
? [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 3,
spreadRadius: 0.5,
offset: const Offset(0, 3))
]
: null),
position: (inFrontOfChild ?? false)
? DecorationPosition.foreground
: DecorationPosition.background,
child: this,
);