layoutButtonsAndCards static method

Widget layoutButtonsAndCards({
  1. double buttonHeight = 54.0,
  2. double cardWidth = 140.0,
  3. double cardHeight = 160.0,
  4. double horizontalPadding = 16.0,
  5. double spacing = 12.0,
  6. int cardCount = 4,
  7. Color? staticColor,
  8. bool animated = true,
  9. Color? baseColor,
  10. Color? highlightColor,
})

Replicates a complex layout with split top action buttons and a horizontal scrolling list of cards.

Implementation

static Widget layoutButtonsAndCards({
  double buttonHeight = 54.0,
  double cardWidth = 140.0,
  double cardHeight = 160.0,
  double horizontalPadding = 16.0,
  double spacing = 12.0,
  int cardCount = 4,
  Color? staticColor,
  bool animated = true,
  Color? baseColor,
  Color? highlightColor,
}) {
  Widget content = Column(
    children: [
      Padding(
        padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
        child: Column(
          children: [
            Row(
              children: [
                Expanded(
                  child: _buildShape(
                    height: buttonHeight,
                    borderRadius: 12,
                    color: staticColor,
                  ),
                ),
                SizedBox(width: spacing),
                Expanded(
                  child: _buildShape(
                    height: buttonHeight,
                    borderRadius: 12,
                    color: staticColor,
                  ),
                ),
              ],
            ),
            SizedBox(height: spacing),
            _buildShape(
              width: double.infinity,
              height: buttonHeight,
              borderRadius: 12,
              color: staticColor,
            ),
          ],
        ),
      ),
      SizedBox(height: spacing * 2),
      SizedBox(
        height: cardHeight,
        child: ListView.separated(
          scrollDirection: Axis.horizontal,
          physics: const NeverScrollableScrollPhysics(),
          padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
          itemCount: cardCount,
          separatorBuilder: (_, _) => SizedBox(width: spacing),
          itemBuilder: (_, _) => _buildShape(
            width: cardWidth,
            height: cardHeight,
            borderRadius: 16,
            color: staticColor,
          ),
        ),
      ),
    ],
  );

  if (!animated) return content;
  return RistoShimmer(
    baseColor: baseColor,
    highlightColor: highlightColor,
    child: content,
  );
}