buildLoader method
Implementation
@override
Widget buildLoader(BuildContext context, AnimationController controller) {
final animatedValue = progress ?? controller.value;
return SizedBox(
width: size,
child: Stack(
alignment: Alignment.center,
children: [
ClipRRect(
borderRadius:
borderRadius ?? BorderRadius.circular(strokeWidth / 2),
child: LinearProgressIndicator(
value: loop ? null : animatedValue,
color: color ?? Colors.blue,
backgroundColor: backgroundColor?.withAlpha((0.2 * 255).toInt()),
minHeight: strokeWidth,
valueColor: gradient != null
? AlwaysStoppedAnimation<Color>(gradient!.colors.first)
: null,
),
),
if (showPercentage)
Positioned.fill(
child: Center(
child: Text(
"${(animatedValue * 100).toInt()}%",
style: TextStyle(
fontSize: strokeWidth * 1.2,
fontWeight: FontWeight.bold,
color: color ?? Colors.black,
),
),
),
),
],
),
);
}