import 'package:double_back_to_close_app/double_back_to_close_app.dart';
import 'package:IQ/app/modules/home/providers/user.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

import 'package:get/get.dart';
import 'package:IQ/app/global/global_snackbar.dart';
import 'package:IQ/app/global/static_informs.dart';
import 'package:IQ/app/global/text_widget.dart';
import 'package:IQ/app/modules/drawerSide/views/drawer_side_view.dart';
import 'package:url_launcher/url_launcher.dart';

import '../controllers/contact_us_controller.dart';

class ContactUsView extends GetView<ContactUsController> {
  ContactUsView({Key? key}) : super(key: key);
  final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection:
          defaultLocale != "en" ? TextDirection.ltr : TextDirection.rtl,
      child: Scaffold(
        backgroundColor: backgroundColor,
        drawerScrimColor: Colors.black.withOpacity(0.7),
        key: scaffoldKey,
        endDrawer: const DrawerSideView(),
        drawerEdgeDragWidth: widthSize(context),
        body: DoubleBackToCloseApp(
          snackBar: snackBar,
          child: Stack(
            children: [
              Container(
                margin: const EdgeInsets.only(top: 250),
                child: SingleChildScrollView(
                  child: Column(
                    children: [
                      const SizedBox(height: 35),
                      Container(
                        padding: const EdgeInsets.all(16),
                        margin: const EdgeInsets.symmetric(horizontal: 20),
                        decoration: BoxDecoration(
                          color: const Color(0xffF8F9FA),
                          borderRadius: BorderRadius.circular(13),
                          border: Border.all(
                            color: const Color(0xff8C5EF6).withOpacity(0.02),
                            width: 2,
                          ),
                        ),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.end,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.end,
                              mainAxisAlignment: MainAxisAlignment.start,
                              children: [
                                const TextWidget(
                                  text: "Phone Number",
                                  fontSize: 16,
                                  color: Color(0xff616F76),
                                ),
                                const SizedBox(height: 6),
                                Directionality(
                                  textDirection: TextDirection.ltr,
                                  child: Row(
                                    children: [
                                      Row(
                                        children: [
                                          Container(
                                            margin: const EdgeInsets.only(
                                                right: 12),
                                            child: const TextWidget(
                                              text: "Kut",
                                              fontSize: 16,
                                              color: Color(0xff6E6E6E),
                                            ),
                                          ),
                                          InkWell(
                                            onTap: () async {
                                              await launchUrl(
                                                Uri.parse('tel:6095'),
                                                mode: LaunchMode
                                                    .externalApplication,
                                              );
                                            },
                                            child: const TextWidget(
                                              text: "6095",
                                              fontSize: 18,
                                              color: Color(0xff0C212C),
                                            ),
                                          ),
                                        ],
                                      ),
                                      Container(
                                        margin: const EdgeInsets.symmetric(
                                          horizontal: 12,
                                        ),
                                        child: Image.asset("assets/dot.png"),
                                      ),
                                      Row(
                                        children: [
                                          Container(
                                            margin: const EdgeInsets.only(
                                                right: 12),
                                            child: const TextWidget(
                                              text: "Basra",
                                              fontSize: 16,
                                              color: Color(0xff6E6E6E),
                                            ),
                                          ),
                                          InkWell(
                                            onTap: () async {
                                              await launchUrl(
                                                Uri.parse('tel:6096'),
                                                mode: LaunchMode
                                                    .externalApplication,
                                              );
                                            },
                                            child: const TextWidget(
                                              text: "6096",
                                              fontSize: 18,
                                              color: Color(0xff0C212C),
                                            ),
                                          ),
                                        ],
                                      ),
                                    ],
                                  ),
                                ),
                              ],
                            ),
                            const SizedBox(width: 16),
                            Container(
                              width: 50,
                              height: 50,
                              padding: const EdgeInsets.all(12),
                              decoration: BoxDecoration(
                                color: brandColor,
                                shape: BoxShape.circle,
                              ),
                              child: SvgPicture.asset(
                                "assets/headphone.svg",
                                color: Colors.white,
                                height: 30,
                                width: 30,
                              ),
                            ),
                          ],
                        ),
                      ),
                      // email
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse('mailto:info@fiberx.iq'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "Email",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "Info@fiberx.iq",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/sms.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      // facebook
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse('https://www.facebook.com/FIBERX.IQ'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "Facebook",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "fb.com/FIBERX.IQ",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/facebook.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      // instgram
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse('https://www.instagram.com/fiberx_iq/'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "Instagram",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "instagram.com/fiberx_iq",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/instgram.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      // linkedin
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse(
                                'https://www.linkedin.com/company/fiberx-iq/'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "LinkedIn",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "linkedin.com/company/fiberx-iq",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/linkedin.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      // youtube
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse('https://www.youtube.com/@FiberXIRAQ'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "Youtube",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "FiberXIRAQ",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/youtube.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      // website
                      const SizedBox(height: 16),
                      InkWell(
                        onTap: () async {
                          await launchUrl(
                            Uri.parse('https://fiberx.iq/'),
                            mode: LaunchMode.externalApplication,
                          );
                        },
                        child: Container(
                          padding: const EdgeInsets.all(16),
                          margin: const EdgeInsets.symmetric(horizontal: 20),
                          decoration: BoxDecoration(
                            color: const Color(0xffF8F9FA),
                            borderRadius: BorderRadius.circular(13),
                            border: Border.all(
                              color: const Color(0xff8C5EF6).withOpacity(0.02),
                              width: 2,
                            ),
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              const Column(
                                crossAxisAlignment: CrossAxisAlignment.end,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  TextWidget(
                                    text: "Website",
                                    fontSize: 16,
                                    color: Color(0xff616F76),
                                  ),
                                  SizedBox(height: 6),
                                  TextWidget(
                                    text: "fiberx.iq",
                                    fontSize: 18,
                                    color: Color(0xff0C212C),
                                  ),
                                ],
                              ),
                              const SizedBox(width: 28),
                              Container(
                                width: 50,
                                height: 50,
                                padding: const EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                  color: brandColor,
                                  shape: BoxShape.circle,
                                ),
                                child: SvgPicture.asset(
                                  "assets/global.svg",
                                  color: Colors.white,
                                  height: 30,
                                  width: 30,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              Container(
                height: 250,
                decoration: BoxDecoration(
                  color: brandColor,
                  image: const DecorationImage(
                    image: AssetImage('assets/background.png'),
                    fit: BoxFit.fill,
                  ),
                ),
                child: Stack(
                  children: [
                    Container(
                      height: 230,
                      decoration: BoxDecoration(
                        color: brandColor,
                        image: const DecorationImage(
                          image: AssetImage('assets/background.png'),
                          fit: BoxFit.fill,
                        ),
                      ),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          SizedBox(
                              height: MediaQuery.of(context).viewPadding.top),
                          Container(
                            margin: const EdgeInsets.symmetric(
                              horizontal: 15,
                            ),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Container(
                                  margin: const EdgeInsets.only(
                                    top: 5,
                                    right: 15,
                                  ),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(
                                        "assets/2/icon.svg",
                                        height: 20,
                                        width: 71.16,
                                      ),
                                      const SizedBox(width: 10),
                                      Image.asset("assets/logo.png"),
                                    ],
                                  ),
                                ),
                                const SizedBox(width: 10),
                                Row(
                                  children: [
                                    Text(
                                      user?.data?.firstname ?? ' . . . ',
                                      style: const TextStyle(
                                        fontSize: 20,
                                        color: Colors.white,
                                        fontWeight: FontWeight.normal,
                                      ),
                                    ),
                                    IconButton(
                                      onPressed: () {
                                        scaffoldKey.currentState
                                            ?.openEndDrawer();
                                      },
                                      icon: const Icon(
                                        Icons.menu,
                                        color: Colors.white,
                                        size: 40,
                                      ),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                          Container(
                            alignment: Alignment.center,
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.center,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                const SizedBox(height: 30),
                                SvgPicture.asset(
                                  'assets/drawer icons/icon5.svg',
                                  height: 50,
                                  width: 50,
                                  color: Colors.white,
                                ),
                                const SizedBox(height: 20),
                                const TextWidget(
                                  text: "Contact Us",
                                  fontSize: 28,
                                  color: Colors.white,
                                  fontWeight: FontWeight.w600,
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
