import 'package:flutter/material.dart';

class StepIndicator extends StatelessWidget{
  final int total;
  final int current;
  final Color color;

  const StepIndicator({super.key, required this.total, required this.current, required this.color});

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        ...List<Widget>.generate(total, (index){
          final bool isActive = index < current;

          return AnimatedContainer(
            duration: const Duration(milliseconds: 200),
            curve: Curves.easeOut,
            margin: const EdgeInsets.symmetric(horizontal: 6),
            width: 16.0,
            height: 16.0,
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              color: isActive ? color : Colors.white,
              border: Border.all(color: color),
            ),
          );
        }),
      ]
    );
  }
}