import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';
import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';

import '../../utils/system_helper.dart';
import '../../config/translations/strings_enum.dart';

class PrivacyAgreement extends StatelessWidget {
  // final VoidCallback? onTermsTap;
  // final VoidCallback? onPrivacyTap;
  final double? fontSize;
  final Color? textColor;
  final Color? linkColor;
  final double? height;
  final EdgeInsetsGeometry? padding;

  const PrivacyAgreement({
    super.key,
    // this.onTermsTap,
    // this.onPrivacyTap,
    this.fontSize,
    this.textColor,
    this.linkColor,
    this.height,
    this.padding,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding ?? EdgeInsets.symmetric(horizontal: 50.w),
      child: Text.rich(
        TextSpan(
          children: [
            TextSpan(
              text: Strings.termsAgreementPrefix.tr,
              style: TextStyle(
                color: textColor ?? Get.reactiveTheme.hintColor,
                fontSize: fontSize ?? 12.sp,
                height: height ?? 1.5,
              ),
            ),
            TextSpan(
              text: Strings.terms.tr,
              style: TextStyle(
                color: linkColor ?? Colors.white,
                fontSize: fontSize ?? 12.sp,
                height: height ?? 1.5,
                fontWeight: FontWeight.w500,
              ),
              recognizer: TapGestureRecognizer()
                ..onTap = SystemHelper.openTermsOfService,
            ),
            TextSpan(
              text: Strings.termsAgreementConnector.tr,
              style: TextStyle(
                color: textColor ?? Get.reactiveTheme.hintColor,
                fontSize: fontSize ?? 12.sp,
                height: height ?? 1.5,
              ),
            ),
            TextSpan(
              text: Strings.privacy.tr,
              style: TextStyle(
                color: linkColor ?? Colors.white,
                fontSize: fontSize ?? 12.sp,
                height: height ?? 1.5,
                fontWeight: FontWeight.w500,
              ),
              recognizer: TapGestureRecognizer()
                ..onTap = SystemHelper.openPrivacyTerms,
            ),
          ],
        ),
        textAlign: TextAlign.center,
      ),
    );
  }
}
