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

import 'text.dart';
import '../ink_wrapper.dart';

class DidvanTitleDivider extends StatelessWidget {
  final String title;
  final Icon? icon;
  final Color? color;
  final Function()? onClick;

  const DidvanTitleDivider(
      {super.key, required this.title, this.onClick, this.icon, this.color});

  @override
  Widget build(BuildContext context) {
    return InkWrapper(
      onPressed: onClick,
      child: Row(
        children: [
          Expanded(
              child: Divider(
            height: 1,
            color: Theme.of(context).colorScheme.border,
          )),
          Padding(
            padding: const EdgeInsets.only(left: 8, right: 8),
            child: Row(
              children: [
                DidvanText(
                  title,
                  style: Theme.of(context).textTheme.bodySmall,
                  color: color != null
                      ? color!
                      : Theme.of(context).colorScheme.inputText,
                ),
                icon != null
                    ? Padding(
                        padding: const EdgeInsets.only(right: 8),
                        child: icon!,
                      )
                    : const SizedBox(),
              ],
            ),
          ),
          Expanded(
              child: Divider(
            height: 1,
            color: Theme.of(context).colorScheme.border,
          )),
        ],
      ),
    );
  }
}
