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

class HaloStepDots extends StatelessWidget {
  const HaloStepDots({
    super.key,
    required this.total,
    required this.current,
  }) : assert(total > 0),
       assert(current >= 1);

  final int total;
  final int current;

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: List.generate(total, (index) {
        final step = index + 1;
        final active = step == current;
        final past = step < current;
        return Padding(
          padding: EdgeInsets.only(right: index == total - 1 ? 0 : HaloSpacing.s8),
          child: AnimatedContainer(
            duration: HaloMotion.fast,
            curve: HaloMotion.ease,
            width: active ? 24 : 8,
            height: 8,
            decoration: BoxDecoration(
              color: active
                  ? HaloTokens.brand
                  : past
                      ? HaloTokens.brandSoft
                      : HaloTokens.border,
              borderRadius: HaloRadius.pill,
            ),
          ),
        );
      }),
    );
  }
}
