import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';

/// The Lucide "heart" silhouette rendered as either an outline (stroke)
/// or a solid fill. Lucide ships only an outline heart, so the liked
/// state fills the same authoritative Lucide path (verified verbatim
/// from lucide-icons/lucide) — keeping both states visually Lucide
/// rather than introducing a Material filled heart. Used by LikeButton
/// (and, re-derived to a VectorDrawable, by the media notification).
class LucideHeart extends StatelessWidget {
  const LucideHeart({
    required this.filled,
    required this.color,
    this.size = 22,
    super.key,
  });

  final bool filled;
  final Color color;
  final double size;

  static const _path =
      'M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 '
      '22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5'
      '-3-3.2-3-5.5';

  @override
  Widget build(BuildContext context) {
    final svg = filled
        ? '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">'
            '<path d="$_path" fill="currentColor"/></svg>'
        : '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">'
            '<path d="$_path" fill="none" stroke="currentColor" '
            'stroke-width="2" stroke-linecap="round" '
            'stroke-linejoin="round"/></svg>';
    return SvgPicture.string(
      svg,
      width: size,
      height: size,
      colorFilter: ColorFilter.mode(color, BlendMode.srcIn),
    );
  }
}
