import 'package:didvan/config/theme_data.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class ItemTitle extends StatelessWidget {
  final String title;
  final TextStyle? style;
  final IconData? icon;
  final Color? color;
  final String? iconWidget;

  const ItemTitle({
    Key? key,
    required this.title,
    this.icon,
    this.color,
    this.style,
    this.iconWidget,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(top: 16, bottom: 12),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          if (iconWidget != null)
            SvgPicture.asset(iconWidget!, color: color),
          if (icon != null)
            Icon(icon, color: color ?? Theme.of(context).colorScheme.title),
          if (iconWidget != null || icon != null) const SizedBox(width: 4),
          DidvanText(
            title,
            style: style ?? Theme.of(context).textTheme.titleMedium,
            color: color ?? Theme.of(context).colorScheme.title,
          )
        ],
      ),
    );
  }
}
