progressIndicator static method

Widget progressIndicator({
  1. required double progress,
  2. String? label,
  3. GlassType type = GlassType.frosted,
  4. Color? progressColor,
})

Glass progress indicator

Implementation

static Widget progressIndicator({
  required double progress,
  String? label,
  GlassType type = GlassType.frosted,
  Color? progressColor,
}) {
  return GlassContainer.card(
    type: type,
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        if (label != null) ...[
          Text(
            label,
            style: AppTextThemes.bodyMedium(
              color: Colors.white,
              fontWeight: FontWeight.w600,
            ),
          ),
          SizedBox(height: 12.h),
        ],
        Stack(
          children: [
            Container(
              height: 8.h,
              decoration: BoxDecoration(
                color: Colors.white.withOpacity(0.2),
                borderRadius: BorderRadius.circular(4.r),
              ),
            ),
            FractionallySizedBox(
              widthFactor: progress.clamp(0.0, 1.0),
              child: Container(
                height: 8.h,
                decoration: BoxDecoration(
                  color: progressColor ?? Colors.white,
                  borderRadius: BorderRadius.circular(4.r),
                ),
              ),
            ),
          ],
        ),
        SizedBox(height: 8.h),
        Text(
          '${(progress * 100).toInt()}%',
          style: AppTextThemes.bodySmall(color: Colors.white70),
        ),
      ],
    ),
  );
}