getCardDecoration method

dynamic getCardDecoration(
  1. {dynamic color,
  2. dynamic borderRadius,
  3. dynamic shape,
  4. required double elevation,
  5. required dynamic offset}
)

Implementation

BoxDecoration getCardDecoration({
  Color? color,
  BorderRadius? borderRadius,
  BoxShape? shape,
  required double elevation,
  required Offset offset,
}) {
  final shadows = [
    BoxShadow(
      color: Colors.black26,
      spreadRadius: 0.25 * elevation,
      blurRadius: 0.5 * elevation,
      offset: offset,
    ),
  ];

  final border = Border.all(
    color: Colors.white24,
    width: 2,
  );

  return BoxDecoration(
    borderRadius: borderRadius,
    color: color,
    shape: shape ?? BoxShape.rectangle,
    boxShadow: shadows.ifElseNull(colors.brightness.isLight),
    border: border.ifElseNull(colors.brightness.isDark),
  );
}