shadow static method

Widget shadow({
  1. Color mainColor = Colors.white,
  2. Color splashColor = Colors.grey,
  3. Color shadowColor = Colors.black38,
  4. Color disableColor = Colors.grey,
  5. Function? onClick,
  6. Function? onDoubleClick,
  7. Function? onLongClick,
  8. double? width,
  9. double? height,
  10. EdgeInsetsGeometry? padding,
  11. required Widget child,
  12. double radius = 4.0,
  13. Offset shadowOffset = Offset.zero,
})

shadow return custom button which has shadow mainColor body color of button. Default: Colors.white splashColor color for splash effect. Default: Colors.grey shadowColor color for shadow button. Default: Colors.black38 disableColor color button if button disable / function onClick off. Default: Colors.grey onClick action when button clicked onDoubleClick action when button double clicked onLongClick action when button long press width width of button height height of button padding padding of button child child of button. Widget can be anything as can as possible radius radius for angle button. Default: 4.0 shadowOffset Position of shadow button. Default: Offset.zero

Implementation

static Widget shadow({
  Color mainColor = Colors.white,
  Color splashColor = Colors.grey,
  Color shadowColor = Colors.black38,
  Color disableColor = Colors.grey,
  Function? onClick,
  Function? onDoubleClick,
  Function? onLongClick,
  double? width,
  double? height,
  EdgeInsetsGeometry? padding,
  required Widget child,
  double radius = 4.0,
  Offset shadowOffset = Offset.zero,
}) {
  return Container(
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(radius),
      boxShadow: [
        BoxShadow(
          blurRadius: 5,
          color: shadowColor,
          offset: shadowOffset,
        ),
      ],
    ),
    child: Material(
      borderRadius: BorderRadius.circular(radius),
      color: onClick == null && onDoubleClick == null && onLongClick == null
          ? disableColor
          : mainColor,
      child: InkWell(
        borderRadius: BorderRadius.circular(radius),
        splashColor: splashColor,
        onTap: onClick == null ? null : () => onClick(),
        onLongPress: onLongClick == null ? null : () => onLongClick(),
        onDoubleTap: onDoubleClick == null ? null : () => onDoubleClick(),
        child: Container(
          width: width,
          height: height,
          padding: width == null
              ? padding ??
                  EdgeInsets.symmetric(
                    horizontal: 16,
                    vertical: 8,
                  )
              : height == null
                  ? EdgeInsets.symmetric(
                      horizontal: 0,
                      vertical: 8,
                    )
                  : null,
          alignment: Alignment.center,
          child: child,
        ),
      ),
    ),
  );
}