getRtBoxWithElevationDynamicMargin method
Creates an elevated card with both horizontal and vertical margins.
Similar to getRtBoxWithElevation but applies the margin value to both horizontal and vertical axes.
Parameters:
childWidget: The widget to wrap.margin: Margin applied both horizontally and vertically (defaults to 8.0).elevation: Shadow depth (defaults to 4.0).borderRadius: Corner radius (defaults to 4.0).color: Background color (defaults to white).padding: Internal padding (defaults to 8.0).
Returns a Card with symmetric margins.
Implementation
Widget getRtBoxWithElevationDynamicMargin(Widget childWidget,
{double margin = 8.0,
double elevation = 4.0,
double borderRadius = 4.0,
Color color = Colors.white,
double padding = 8.0}) {
return Card(
elevation: elevation,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius),
),
margin: EdgeInsets.symmetric(vertical: margin, horizontal: margin),
color: color,
child: Padding(
padding: EdgeInsets.all(padding),
child: childWidget,
),
);
}