import 'package:flutter/material.dart';

import 'package:pweb/pages/dashboard/buttons/balance/config.dart';


class CarouselIndicator extends StatelessWidget {
  final int itemCount;
  final int index;

  const CarouselIndicator({
    super.key,
    required this.itemCount,
    required this.index,
  });

  @override
  Widget build(BuildContext context) => Row(
    mainAxisAlignment: MainAxisAlignment.center,
    children: List.generate(
      itemCount,
      (i) => _Dot(isActive: i == index),
    ),
  );
}

class _Dot extends StatelessWidget {
  final bool isActive;

  const _Dot({required this.isActive});

  @override
  Widget build(BuildContext context) {
    final color = Theme.of(context).colorScheme.primary;

    return Container(
      width: WalletCardConfig.dotSize,
      height: WalletCardConfig.dotSize,
      margin: WalletCardConfig.dotMargin,
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        color: isActive ? color : color.withAlpha(64),
      ),
    );
  }
}
