listItem static method

Widget listItem({
  1. bool showAvatar = true,
  2. int textLines = 2,
})

List item skeleton

Implementation

static Widget listItem({bool showAvatar = true, int textLines = 2}) {
  return Padding(
    padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
    child: Row(
      children: [
        if (showAvatar) ...[
          const SkeletonLoader.circle(radius: 24),
          const SizedBox(width: 12),
        ],
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const SkeletonLoader(height: 14, width: 120, borderRadius: 4),
              const SizedBox(height: 6),
              for (int i = 1; i < textLines; i++) ...[
                SkeletonLoader(
                  height: 12,
                  width: i == textLines - 1 ? 80 : double.infinity,
                  borderRadius: 4,
                ),
                if (i < textLines - 1) const SizedBox(height: 4),
              ],
            ],
          ),
        ),
      ],
    ),
  );
}