import 'package:flutter/material.dart';
import 'package:sendtrain/extensions/string_extensions.dart';

class ActivityViewCategories<T extends List<Enum>> extends StatelessWidget {
  const ActivityViewCategories(
      {super.key,
      required this.object,
      required this.icon,
      required this.text});

  final T object;
  final Icon icon;
  final String text;

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      shrinkWrap: true,
      scrollDirection: Axis.horizontal,
      // padding: const EdgeInsets.only(right: 10, left: 10),
      itemCount: object.length,
      itemBuilder: (BuildContext context, int index) {
        return Padding(
            padding: EdgeInsets.only(right: 5),
            child: ActionChip(
              visualDensity: VisualDensity.compact,
              avatar: icon,
              label: Text(maxLines: 1, object[index].name.toTitleCase()),
              tooltip: text,
              onPressed: () {},
            ));
      },
    );
  }
}
