import 'package:flutter/material.dart';

class AppTitleList extends StatelessWidget {
  final String title;
  final Widget? subtitle;
  final Widget tail;
  final bool isSelected;
  final VoidCallback? onTap;

  const AppTitleList(
      {super.key,
      required this.title,
      required this.tail,
      required this.isSelected,
      this.subtitle,
      this.onTap});

  @override
  Widget build(BuildContext context) {
    final titleWidget = Text(
      title,
      style: const TextStyle(
          fontSize: 14.22,
          fontWeight: FontWeight.w700,
          color: Color(0xff333333)),
    );

    return GestureDetector(
        onTap: onTap,
        child: Container(
          decoration: const BoxDecoration(color: Colors.white, boxShadow: [
            BoxShadow(color: Color(0x4d000000), blurRadius: 3.5)
          ]),
          height: 55.5,
          width: double.infinity,
          margin: const EdgeInsets.only(top: 7),
          padding: const EdgeInsets.only(right: 11),
          child: Row(
            children: [
              Container(
                margin: const EdgeInsets.only(right: 10),
                height: double.infinity,
                width: 6.4,
                color:
                    isSelected ? const Color(0xffff870d) : Colors.transparent,
              ),
              Expanded(
                  child: subtitle != null
                      ? Column(
                          mainAxisSize: MainAxisSize.min,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [titleWidget, subtitle!!],
                        )
                      : titleWidget),
              const SizedBox(width: 8),
              tail
            ],
          ),
        ));
  }
}
