import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../config/config.dart';
import '../config/size_config.dart';
import '../core/viewModel/project_view_model.dart';
import '../widgets/shared/app_texts_widget.dart';

class TabUtils {
  static getBoxTabsBoxDecoration(
      {bool isFirst = false,
      bool isMiddle = false,
      bool isLast = false,
      bool isActive = false,
      double radius = 6.0,
      required ProjectViewModel projectViewModel}) {
    return BoxDecoration(
      color: isActive ? AppGlobal.appRedColor : Color(0xFFEAEAEA),
      shape: BoxShape.rectangle,
      borderRadius: BorderRadius.only(
          topRight: projectViewModel.isArabic
              ? Radius.circular(isActive
                  ? isLast || isMiddle
                      ? radius
                      : 0
                  : 0)
              : Radius.circular(isActive
                  ? isFirst || isMiddle
                      ? radius
                      : 0
                  : 0),
          topLeft: projectViewModel.isArabic
              ? Radius.circular(isActive
                  ? isFirst || isMiddle
                      ? radius
                      : 0
                  : 0)
              : Radius.circular(isActive
                  ? isLast || isMiddle
                      ? radius
                      : 0
                  : 0),
          bottomRight: projectViewModel.isArabic
              ? Radius.circular(isActive
                  ? isLast || isMiddle
                      ? radius
                      : 0
                  : 0)
              : Radius.circular(isActive
                  ? isFirst || isMiddle
                      ? radius
                      : 0
                  : 0),
          bottomLeft: projectViewModel.isArabic
              ? Radius.circular(isActive
                  ? isFirst || isMiddle
                      ? radius
                      : 0
                  : 0)
              : Radius.circular(isActive
                  ? isLast || isMiddle
                      ? radius
                      : 0
                  : 0)),
    );
  }

  static getBgTabColor() {
    return Color(0xFFEAEAEA);
  }

  static getTabText({
    required String title,
    bool isActive = false,
  }) {
    return AppText(
      title,
      fontSize: SizeConfig.textMultiplier! * 1.8,
      color: isActive ? Colors.white : AppGlobal.appTextColor,
      letterSpacing: -0.48,
      fontWeight: FontWeight.w600,
    );
  }

  static getTabHeight(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return screenSize.height * 0.07;
  }

  static getTabCounter({bool isActive = false, int counter = 0}) {
    return Container(
      margin: EdgeInsets.all(4),
      width: 15,
      height: 15,
      decoration: BoxDecoration(
        color: isActive ? Colors.white : AppGlobal.appRedColor,
        shape: BoxShape.circle,
      ),
      child: Center(
        child: FittedBox(
          child: AppText(
            "$counter",
            fontSize: SizeConfig.textMultiplier! * 1.5,
            color: !isActive ? Colors.white : AppGlobal.appRedColor,
            fontWeight: FontWeight.w700,
          ),
        ),
      ),
    );
  }
}
