textLines static method
Generates a layout of multiple skeleton text lines. Wraps all lines in a SINGLE shimmer so the sweep effect travels across them seamlessly.
Implementation
static Widget textLines({
int lines = 2,
double lineHeight = 14.0,
double spacing = 8.0,
bool lastLineShort = true,
Color? staticColor,
bool animated = true,
Color? baseColor,
Color? highlightColor,
}) {
Widget content = Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: List.generate(lines, (index) {
final isLast = index == lines - 1;
return _buildShape(
width: (isLast && lastLineShort) ? 120.0 : double.infinity,
height: lineHeight,
borderRadius: lineHeight / 2,
color: staticColor,
margin: EdgeInsets.only(bottom: isLast ? 0 : spacing),
);
}),
);
if (!animated) return content;
return RistoShimmer(
baseColor: baseColor,
highlightColor: highlightColor,
child: content,
);
}