shadow method

Widget shadow(
  1. double radius, {
  2. Color color = const Color.fromRGBO(0, 0, 0, .5),
  3. double blur = 25,
  4. double x = 0,
  5. double y = 0,
})

A modifier that casts a box shadow under its widget.

.shadow() can cast non-rectangular shadows if the box is non-rectangular (e.g., has a border radius or a circular shape).

This modifier is similar to CSS box-shadow.

Example:

Icon(Icons.person)
    .shadow(4, blur: 40);

Implementation

Widget shadow(
  double radius, {
  Color color = const Color.fromRGBO(0, 0, 0, .5),
  double blur = 25,
  double x = 0,
  double y = 0,
}) {
  var shadow = BoxShadow(
    color: color,
    spreadRadius: radius,
    blurRadius: blur,
    offset: Offset(x, y),
  );
  var decoration = BoxDecoration(boxShadow: [shadow]);
  if (this.decoration is BoxDecoration) {
    decoration = (this.decoration as BoxDecoration).rebase(
      boxShadow: [shadow],
    );
  }
  return _rebase(decoration: decoration);
}