import 'package:IQ/app/modules/about/controllers/about_controller.dart';
import 'package:IQ/app/modules/home/providers/user.dart';
import 'package:flutter/material.dart';
import 'package:get/get_state_manager/src/simple/get_view.dart';
import 'package:double_back_to_close_app/double_back_to_close_app.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';

class AboutView extends GetView<AboutController> {
  AboutView({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: Column(
                  children: [
                    const SizedBox(height: 35),
                    Container(
                      margin: const EdgeInsets.symmetric(horizontal: 15),
                      alignment: Alignment.centerLeft,
                      child: TextWidget(
                        text: 'About FiberX',
                        fontSize: 18,
                        fontWeight: FontWeight.w500,
                        color: brandColor,
                      ),
                    ),
                    Container(
                      margin: const EdgeInsets.all(15),
                      padding: const EdgeInsets.symmetric(
                        horizontal: 10,
                        vertical: 15,
                      ),
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(10),
                        border: Border.all(color: Colors.grey, width: 1),
                      ),
                      child: const TextWidget(
                        text:
                            "شركة رائدة في مجال الاتصالات وشريك رسمي لوزارة الاتصالات العراقية. المنجز والمنفذ والمشغل الفعلي لمشروع FTTH في محافظة واسط والبصرة.",
                        fontSize: 16,
                        fontWeight: FontWeight.w400,
                        color: Colors.black,
                        textAlign: TextAlign.right,
                      ),
                    ),
                  ],
                ),
              ),
              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/info-circle.svg',
                                  height: 50,
                                  width: 50,
                                  color: Colors.white,
                                ),
                                const SizedBox(height: 20),
                                const TextWidget(
                                  text: "About FiberX",
                                  fontSize: 28,
                                  color: Colors.white,
                                  fontWeight: FontWeight.w600,
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
