import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/style.dart';

class DateTimeWebWidget extends StatelessWidget {
  const DateTimeWebWidget({
    super.key,
    required this.size,
    required this.isRequired,
    required this.title,
    required this.startTime,
    required this.endTime,
    required this.firstString,
    required this.secondString,
    required this.icon,
  });

  final Size size;
  final String title;
  final bool isRequired;
  final String firstString;
  final String secondString;
  final String icon;
  final Function()? startTime;
  final Function()? endTime;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        Row(
          children: [
            if (isRequired)
              Text(
                '* ',
                style: Theme.of(context)
                    .textTheme
                    .bodyMedium!
                    .copyWith(color: Colors.red),
              ),
            Text(
              title,
              style: Theme.of(context)
                  .textTheme
                  .bodySmall!
                  .copyWith(color: Colors.black, fontSize: 13),
            ),
          ],
        ),
        const SizedBox(
          height: 8,
        ),
        Container(
          // height: size.height * 0.056,
          padding:
              const EdgeInsets.only(top: 10, bottom: 10, right: 30, left: 10),
          decoration: containerDecoration,
          child: FittedBox(
              child: Column(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  InkWell(
                      onTap: startTime,
                      child: FittedBox(
                        child: Text(
                          firstString,
                          style: Theme.of(context)
                              .textTheme
                              .bodySmall!
                              .copyWith(
                                  color: ColorsManager.grayColor,
                                  fontSize: 12,
                                  fontWeight: FontWeight.w400),
                        ),
                      )),
                  const SizedBox(
                    width: 30,
                  ),
                  const Icon(
                    Icons.arrow_right_alt,
                    color: ColorsManager.grayColor,
                  ),
                  const SizedBox(
                    width: 30,
                  ),
                  InkWell(
                      onTap: endTime,
                      child: FittedBox(
                        child: Text(
                          secondString,
                          style: Theme.of(context)
                              .textTheme
                              .bodySmall!
                              .copyWith(
                                  color: ColorsManager.grayColor,
                                  fontSize: 12,
                                  fontWeight: FontWeight.w400),
                        ),
                      )),
                  const SizedBox(
                    width: 30,
                  ),
                  SvgPicture.asset(
                    icon,
                  ),
                ],
              ),
            ],
          )),
        ),
      ],
    );
  }
}
