toSkeletonLine method
Creates a skeleton line matching this text's style.
Implementation
Widget toSkeletonLine({
SkeletonConfig? config,
double? width,
double? widthFactor = 0.8,
}) {
final effectiveConfig = config ?? SkeletonConfig.defaultConfig;
// Estimate height from style
final height = style?.fontSize ?? 16.0;
// Use provided width or calculate from factor
double? effectiveWidth = width;
if (effectiveWidth == null && widthFactor != null && data != null) {
// Rough estimate: 0.6 * fontSize per character
final estimatedFullWidth = data!.length * (style?.fontSize ?? 16) * 0.6;
effectiveWidth = estimatedFullWidth * widthFactor;
}
return SkeletonLine(
config: effectiveConfig,
width: effectiveWidth,
height: height,
);
}