getRoundBoxWithElevation method

Widget getRoundBoxWithElevation({
  1. required Widget child,
  2. double elevation = 4,
  3. double? padding,
  4. double borderRadius = 20,
  5. double verticalMargin = 8.0,
  6. Color color = Colors.white,
})

Creates a rounded elevated card container with highly customizable corner radius.

Similar to getBoxWithElevation, but provides explicit control over border radius with a default of 20px for a more rounded appearance.

Parameters:

  • child: The widget to be wrapped in the card.
  • elevation: Shadow depth (defaults to 4).
  • padding: Internal padding. Uses Utils.appConstants.boxPadding if null.
  • borderRadius: Corner radius (defaults to 20).
  • verticalMargin: Vertical spacing around the card (defaults to 8.0).
  • color: Background color (defaults to white).

Returns a Card with rounded corners.

Example:

getRoundBoxWithElevation(
  child: ProfileWidget(),
  borderRadius: 25,
  elevation: 8,
);

Implementation

Widget getRoundBoxWithElevation(
    {required Widget child,
    double elevation = 4,
    double? padding,
    double borderRadius = 20,
    double verticalMargin = 8.0,
    Color color = Colors.white}) {
  return Card(
    elevation: elevation,
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(borderRadius),
    ),
    margin: EdgeInsets.symmetric(vertical: verticalMargin),
    color: color,
    child: Padding(
      padding: EdgeInsets.all(padding ?? Utils.appConstants.boxPadding),
      child: child,
    ),
  );
}