import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:flutter/material.dart'; class ProgressBar extends StatelessWidget { final String title; final RxInt value; final Color color; const ProgressBar({ super.key, required this.title, required this.value, required this.color, }); @override Widget build(BuildContext context) { return Obx(() { final double progress = (value.value / 100).clamp(0.0, 1.0); return Container( child: Row( children: [ Text(title), SizedBox(width: 3.w), Expanded( child: Stack( children: [ Container( height: 11.h, decoration: BoxDecoration( color: color.withValues(alpha: 0.3), borderRadius: BorderRadius.circular(53.r), ), ), FractionallySizedBox( widthFactor: progress, child: Container( height: 11.h, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(53.r), ), ), ), Positioned.fill( child: Center( child: Text( "${value.value}%", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 7.sp, fontWeight: FontWeight.w500, shadows: [ Shadow( color: Colors.black.withValues(alpha: 0.6), offset: Offset(1, 1), blurRadius: 3.r, ), ], ), ), ), ), ], ), ), ], ), ); }); } }