import 'package:flutter/material.dart';

import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:taafee_mobile/common/extensions/widget_extension.dart';
import 'package:taafee_mobile/features/home/business_logic_layer/home_controller.dart';

import '../../core/routing/routing_manager.dart';
import '../const/const.dart';
import 'text.dart';

class HeaderScreen extends StatelessWidget {
  final String title;
  final Color? textColor;
  final Color? iconColor;
  final void Function()? additionalOnTap;
  final HomeController homeController = Get.find<HomeController>();
  HeaderScreen(this.title,
      {super.key, this.additionalOnTap, this.iconColor, this.textColor});

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        SizedBox(
          width: 32,
          child: Obx(
            () => (!homeController.isArabic.value)
                ? SvgPicture.asset(
                    "assets/icons/arrow-left.svg",
                    width: Responsive.isTablet() ? 25 : null,
                    colorFilter: (iconColor != null)
                        ? ColorFilter.mode(iconColor!, BlendMode.srcIn)
                        : null,
                  )
                : SvgPicture.asset(
                    "assets/icons/arrow right.svg",
                    width: Responsive.isTablet() ? 20 : null,
                    colorFilter: (iconColor != null)
                        ? ColorFilter.mode(iconColor!, BlendMode.srcIn)
                        : null,
                  ),
          ),
        ).onTap(
          () {
            RoutingManager.back();
          },
        ),
        BoldTextWidget(
          title,
          fontSize: Responsive.isTablet() ? 24 : 18,
          color: textColor ?? AppColors.textColor,
        ).paddingSymmetric(horizontal: 10),
      ],
    ).paddingSymmetric(horizontal: Responsive.isTablet() ? 2 : 4);
  }
}
