import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';

class ProgressBar extends StatelessWidget {
  final double max;
  final double value;
  final double height;
  final double textSize;
  final double textSecondarySize;
  final Color backgroundColor;
  final Color foregroundColor;
  final Color textColor;

  const ProgressBar({
    super.key,
    required this.max,
    required this.value,
    required this.height,
    required this.textSize,
    required this.textSecondarySize,
    required this.backgroundColor,
    required this.foregroundColor,
    required this.textColor,
  });

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        LinearProgressIndicator(
          value: value / max,
          minHeight: height,
          borderRadius: BorderRadius.all(Radius.circular(24)),
          color: foregroundColor,
          backgroundColor: backgroundColor,
        ),
        FractionallySizedBox(
          widthFactor: value / max,
          child: SizedBox(
            height: height,
            child: Center(
              child: MoneyText(
                text: "$value€",
                size: textSize,
                secondarySize: textSecondarySize,
                color: textColor,
              ),
            ),
          ),
        ),
      ],
    );
  }
}
