buildProductSmoothCard function

Widget buildProductSmoothCard({
  1. required Widget body,
  2. Widget? header,
  3. Widget? title,
  4. EdgeInsetsGeometry? titlePadding,
  5. EdgeInsetsGeometry? padding = EdgeInsets.zero,
  6. EdgeInsetsGeometry? margin = const EdgeInsets.symmetric(horizontal: SMALL_SPACE),
  7. BorderRadius? borderRadius,
})

A SmoothCard on Product cards using default margin and padding.

Implementation

Widget buildProductSmoothCard({
  required Widget body,
  Widget? header,
  Widget? title,
  EdgeInsetsGeometry? titlePadding,
  EdgeInsetsGeometry? padding = EdgeInsets.zero,
  EdgeInsetsGeometry? margin = const EdgeInsets.symmetric(
    horizontal: SMALL_SPACE,
  ),
  BorderRadius? borderRadius,
}) {
  assert(
    (header != null && title == null) || header == null,
    "You can't pass a header and a title at the same time",
  );

  Widget child;

  if (title != null) {
    child = Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        _ProductSmoothCardTitle(title: title, padding: titlePadding),
        body,
      ],
    );
  } else if (header != null) {
    child = Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[header, body],
    );
  } else {
    child = body;
  }

  return child;
}