import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';
import '../../../components/spacer/spacer.dart';

class HomeTaskTile extends StatelessWidget {
  final String title;
  final String subtitle;
  final bool isCompleted;
  final Color color;
  const HomeTaskTile({
    super.key,
    required this.title,
    required this.subtitle,
    this.isCompleted = false,
    required this.color,
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Container(
          width: 24,
          height: 24,
          decoration: BoxDecoration(
            color: isCompleted ? color : Colors.transparent,
            borderRadius: BorderRadius.circular(6),
            border: Border.all(color: color, width: 2),
          ),
          child: isCompleted
              ? Icon(Icons.check_rounded, color: AppColor.white, size: 16)
              : null,
        ),
        const SpaceWidth(16),
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                title,
                style: AppStyle.md.copyWith(
                  fontWeight: FontWeight.w600,
                  color: isCompleted
                      ? AppColor.textSecondary
                      : AppColor.textPrimary,
                  decoration: isCompleted
                      ? TextDecoration.lineThrough
                      : TextDecoration.none,
                ),
              ),
              const SpaceHeight(2),
              Text(
                subtitle,
                style: AppStyle.sm.copyWith(
                  color: AppColor.textLight,
                  decoration: isCompleted
                      ? TextDecoration.lineThrough
                      : TextDecoration.none,
                ),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
