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

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

  const ItemTitle({
    Key? key,
    required this.title,
    this.icon,
    this.color,
    this.style,
  }) : 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 (icon != null)
            Icon(icon, color: color ?? Theme.of(context).colorScheme.title),
          if (icon != null) const SizedBox(width: 4),
          DidvanText(
            title,
            style: style ?? Theme.of(context).textTheme.subtitle1,
            color: color ?? Theme.of(context).colorScheme.title,
          )
        ],
      ),
    );
  }
}
