getCardDecoration method

BoxDecoration getCardDecoration({
  1. required double elevation,
  2. required Offset offset,
  3. Color? color,
  4. BorderRadius? borderRadius,
  5. BoxShape? shape,
})

Implementation

BoxDecoration getCardDecoration({
  required double elevation,
  required Offset offset,
  Color? color,
  BorderRadius? borderRadius,
  BoxShape? shape,
}) {
  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),
  );
}