import 'package:flutter/material.dart';

import '../utils/spaces.dart';

class DotSelector extends StatelessWidget {
  const DotSelector({Key? key, this.primaryColor, required this.pageCount, required this.selectedPage}) : super(key: key);

  final Color? primaryColor;
  final int pageCount;
  final int selectedPage;

  @override
  Widget build(BuildContext context) {
    const double height = 5;
    const double width = 10;
    const double selectedheight = 5;
    const double selectedwidth = 17;
    return ListView.builder(
      scrollDirection: Axis.horizontal,
      itemCount: pageCount,
      itemBuilder: (context, index) {
        return Row(
          children: [
            Container(
              width: selectedPage == index ? selectedwidth : width,
              height: selectedPage == index ? selectedheight : height,
              decoration: BoxDecoration(color: selectedPage == index ? primaryColor??Colors.black : Colors.grey, shape: BoxShape.rectangle),
            ),
            const SpaceBoxWidth.low(),
          ],
        );
      },
    );
  }
}
