import 'package:flutter/material.dart'; import 'package:english_learning/core/utils/styles/theme.dart'; class ProgressBar extends StatelessWidget { final int currentProgress; final int totalProgress; const ProgressBar({ super.key, required this.currentProgress, required this.totalProgress, }); @override Widget build(BuildContext context) { final progress = totalProgress > 0 ? currentProgress / totalProgress : 0.0; return LayoutBuilder( builder: (context, constraints) { final barWidth = constraints.maxWidth - 40; return Row( children: [ SizedBox( width: barWidth, child: Container( height: 12, decoration: BoxDecoration( color: Colors.grey.shade300, borderRadius: BorderRadius.circular(7), ), child: Stack( children: [ AnimatedContainer( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, width: barWidth * progress, decoration: BoxDecoration( color: AppColors.blueColor, borderRadius: BorderRadius.circular(7), ), ), ], ), ), ), const Spacer(), Text( '$currentProgress/$totalProgress', style: AppTextStyles.blueTextStyle.copyWith( fontSize: 14, fontWeight: FontWeight.w500, ), ), ], ); }, ); } }