import 'package:flutter/material.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/theme/colors.dart';


class CategoriesList extends StatelessWidget {
  // We will pass a list here!
  final String name;
  final Function() onTapped;
  const CategoriesList({Key? key, required this.name, required this.onTapped}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 37,
      width: double.infinity,
      child: ListView.builder(
          padding: const EdgeInsets.only(left: 12),
          itemCount: 20,
          scrollDirection: Axis.horizontal,
          itemBuilder: (BuildContext context, int index) {
            return InkWell(
              onTap: onTapped,
              child: Container(
                alignment: Alignment.center,
                padding: const EdgeInsets.symmetric(horizontal: 8),
                margin: const EdgeInsets.symmetric(horizontal: 8),
                decoration: BoxDecoration(
                  color: index < 1 ? MyColors.darkIconColor : null,
                  border: Border.all(
                    color: index < 1 ? MyColors.darkIconColor : MyColors.primaryColor,
                    width: 2,
                  ),
                ),
                child: name.toText(
                  fontSize: 12,
                  color: index < 1 ? MyColors.white : null,
                ),
              ),
            );
          }),
    );
  }
}
