card static method

Widget card({
  1. double height = 120,
  2. bool showImage = true,
  3. int textLines = 2,
})

Card skeleton

Implementation

static Widget card({
  double height = 120,
  bool showImage = true,
  int textLines = 2,
}) {
  return Container(
    margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
    padding: const EdgeInsets.all(12),
    decoration: BoxDecoration(
      color: Colors.grey[900],
      borderRadius: BorderRadius.circular(12),
    ),
    child: Row(
      children: [
        if (showImage) ...[
          const SkeletonLoader(
            width: 80,
            height: 80,
            borderRadius: 8,
          ),
          const SizedBox(width: 12),
        ],
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const SkeletonLoader(height: 16, borderRadius: 4),
              const SizedBox(height: 8),
              for (int i = 0; i < textLines; i++) ...[
                SkeletonLoader(
                  height: 12,
                  width: i == textLines - 1 ? 100 : double.infinity,
                  borderRadius: 4,
                ),
                if (i < textLines - 1) const SizedBox(height: 6),
              ],
            ],
          ),
        ),
      ],
    ),
  );
}