import 'package:flutter/material.dart';

class OnboardingPageIndicator extends StatelessWidget {
  final int current;
  final int count;

  const OnboardingPageIndicator({
    required this.current,
    required this.count,
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    final color = Theme.of(context).colorScheme.primary;
    final outlineColor = Theme.of(context).colorScheme.secondary;
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: List.generate(count, (i) {
        final isActive = i == current;
        final isLast = i == count - 1;
        return AnimatedContainer(
          duration: const Duration(milliseconds: 200),
          margin: const EdgeInsets.symmetric(horizontal: 4),
          width: isActive ? 24 : 8,
          height: 8,
          decoration: BoxDecoration(
            color: isActive ? color : color.withOpacity(0.3),
            borderRadius: BorderRadius.circular(4),
            border: isLast && !isActive
                ? Border.all(color: outlineColor, width: 1.5)
                : null,
          ),
        );
      }),
    );
  }
}
