import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class RoutineDialogSelectionListTile extends StatelessWidget {
  const RoutineDialogSelectionListTile({
    required this.iconPath,
    required this.description,
    required this.isSelected,
    required this.onTap,
    super.key,
  });

  final bool isSelected;
  final String iconPath;
  final String description;
  final void Function() onTap;

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: SvgPicture.asset(
        iconPath,
        width: 24,
        height: 24,
        placeholderBuilder: (context) => Container(
          width: 24,
          height: 24,
          color: Colors.transparent,
        ),
      ),
      title: Text(
        description,
        style: context.textTheme.bodyMedium,
      ),
      trailing: Icon(
        isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked,
        size: 24,
        color: isSelected
            ? ColorsManager.primaryColorWithOpacity
            : ColorsManager.textGray,
      ),
      onTap: onTap,
    );
  }
}
