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,
  6. bool handover = true,
})

A modifier that sets its widget's frame size.

Example:

Icon(Icons.person)
    .shadow(4, color: Colors.grey);

Implementation

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