import 'package:flutter/material.dart';

import '../../app/constant.dart';

class ChipType extends StatelessWidget {
  ChipType(
      {super.key,
      required this.tipe,
      required this.name,
      required this.isDetailHistory});
  final int tipe;
  final String name;
  bool isDetailHistory = false;
  @override
  Widget build(BuildContext context) {
    switch (tipe) {
      case 5:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.backgroundBlue,
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryBlue)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryBlue),
          ),
        );

      case 1:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.backgroundOrange,
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryOrange)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryOrange),
          ),
        );

      case 3:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.backgroundGreen,
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryGreen)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryGreen),
          ),
        );

      case 2:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.backgroundPurple,
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryPurple)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryPurple),
          ),
        );

      case 4:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.primaryRed.withOpacity(0.25),
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryRed)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryRed),
          ),
        );

      default:
        return Container(
          padding: EdgeInsets.symmetric(
              horizontal: Constant.getActualX(context: context, x: 8)),
          decoration: BoxDecoration(
              color: Constant.backgroundBlue,
              borderRadius: BorderRadius.circular(6)),
          child: Text(
            name,
            overflow: TextOverflow.ellipsis,
            style: isDetailHistory
                ? Constant.body1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryBlue)
                : Constant.caption1(context: context).copyWith(
                    fontWeight: FontWeight.w600, color: Constant.primaryBlue),
          ),
        );
    }
  }
}
