import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:tanami_app/core/styles/app_color.dart';
import 'package:tanami_app/core/styles/app_images.dart';
import 'package:tanami_app/core/styles/app_text.dart';
import 'package:tanami_app/core/utils/url_launcher/url_launcher.dart';

import '../../../../shared/components/text_widget.dart';

Widget bottomSection() {
  return Padding(
    padding: const EdgeInsets.all(22.0),
    child: Column(
      children: [
        const Gap(50.0),
        contactOption(
          icon: AppImages.byPhoneIcon,
          title: AppText.byPhoneText,
          subtitle: '+973 12345678',
          onTap: () {
            launchPhone('+973 12345678');
          },
        ),
        const Gap(16.0),
        contactOption(
          icon: AppImages.byMailIcon,
          title: AppText.byEmailText,
          subtitle: 'info@tanamicapital.com',
          onTap: () {
            launchEmail('info@tanamicapital.com');
          },
        ),
      ],
    ),
  );
}

Widget contactOption({
  required String icon,
  required String title,
  required String subtitle,
  required VoidCallback onTap,
}) {
  return GestureDetector(
    onTap: onTap,
    child: Container(
      padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
      decoration: BoxDecoration(
        color: AppColor.contactAdminBgColor,
        borderRadius: BorderRadius.circular(22.0),
      ),
      child: Row(
        children: [
          SvgPicture.asset(
            icon,
          ),
          const Gap(16.0),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              TextWidget().text14W600(
                title,
                clr: AppColor.contactAdminIconColor,
              ),
              TextWidget().text14W400(
                subtitle,
                clr: AppColor.contactAdminIconColor,
              ),
            ],
          ),
          const Spacer(),
          const Icon(
            Icons.arrow_forward_ios,
            color: AppColor.contactAdminIconColor,
          ),
        ],
      ),
    ),
  );
}
