import 'package:boilerplate/core/di/injection_init.dart';
import 'package:boilerplate/core/styles/my_dimensions.dart';
import 'package:boilerplate/core/utils/navigator_util.dart';
import 'package:boilerplate/domain/entities/flavor/flavor_data.dart';
import 'package:boilerplate/presentation/screen/web_view/web_view_screen.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher_string.dart';

import '../../../../core/styles/my_font.dart';

class HomeBusinessMatching extends StatelessWidget {
  final String? myLang;

  HomeBusinessMatching({Key? key, this.myLang}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(
        top: MyDimens.dimen18,
        bottom: MyDimens.dimen28,
        left: MyDimens.dimen16,
        right: MyDimens.dimen16,
      ),
      child: Column(
        children: [
          GestureDetector(
            onTap: () async {
              print(getIt.get<AppFlavorData>().webDomain + '/ipmartadm/order');
              if (await canLaunchUrlString(
                  getIt.get<AppFlavorData>().webDomain + '/ipmartadm/order')) {
                launchUrlString(
                  getIt.get<AppFlavorData>().webDomain + '/ipmartadm/order',
                  mode: LaunchMode.externalApplication,
                );
              }
            },
            child: Container(
              child: Stack(
                children: [
                  Container(
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Color.fromRGBO(241, 91, 68, 1),
                    ),
                    width: MediaQuery.of(context).size.width,
                    height: MyDimens.dimen100,
                    // child: Image.asset(
                    //   "assets/images/catagories.png",
                    // ),
                  ),
                  Container(
                    child: Image.asset(
                      "assets/images/ic_1.png",
                      width: MyDimens.dimen46,
                      height: MyDimens.dimen46,
                    ),
                    margin: EdgeInsets.only(
                        top: MyDimens.dimen30, left: MyDimens.dimen24),
                  ),
                  Container(
                    margin: EdgeInsets.only(
                        top: MyDimens.dimen24, left: MyDimens.dimen76),
                    child: Text(
                      // 'เสนอขายผลงาน',
                      'Idea Offer',
                      style: MyFont.regular20.copyWith(color: Colors.white),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(
                        top: MyDimens.dimen48, left: MyDimens.dimen76),
                    child: Text(
                      // 'ขั้นตอนการลงทะเบียนผู้ขาย',
                      this.myLang == 'th' || this.myLang == ""
                          ? "เสนอขาย"
                          : "Sign up for IP owner",
                      style: MyFont.regular16.copyWith(color: Colors.white),
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    margin: EdgeInsets.only(
                        top: MyDimens.dimen12, left: MyDimens.dimen245 + 16),
                    child: Text(
                      this.myLang == 'th' || this.myLang == ""
                          ? "เสนอขาย"
                          : "Seller",
                      textAlign: TextAlign.center,
                      style: MyFont.medium14.copyWith(color: Colors.white),
                    ),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Color.fromRGBO(23, 19, 78, 1),
                    ),
                    height: MyDimens.dimen30,
                    width: MyDimens.dimen70,
                  ),
                ],
              ),
            ),
          ),
          GestureDetector(
            onTap: () async {
              NavigatorUtil.pushToPage(
                WebViewScreen(
                  key: UniqueKey(),
                  title: this.myLang == 'th' || this.myLang == ""
                      ? 'ข้อมูลผู้ขาย'
                      : "Seller Information",
                  // url: getIt.get<AppFlavorData>().webDomain +
                  //     '/me?tabs=tabs-2#tabs-2mobile=1&lang=${this.myLang}',
                  url: getIt.get<AppFlavorData>().webDomain +
                      '/sellers-list?mobile=1&lang=${this.myLang}',
                ),
              );
            },
            child: Container(
              alignment: Alignment.center,
              margin: EdgeInsets.only(top: MyDimens.dimen24, left: 0),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(24),
                color: Color.fromRGBO(2, 29, 79, 1),
              ),
              // height: 50,
              width: MediaQuery.of(context).size.width,
              height: MyDimens.dimen100,
              child: Row(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 0, left: MyDimens.dimen24),
                    child: Icon(
                      Icons.feed_outlined,
                      color: Colors.white,
                      size: MyDimens.dimen46,
                    ),
                  ),
                  Stack(
                    children: [
                      Container(
                        margin: EdgeInsets.only(
                            top: MyDimens.dimen14, left: MyDimens.dimen12),
                        child: Text(
                          'Seller Information',
                          style: MyFont.regular20.copyWith(color: Colors.white),
                        ),
                      ),
                      Container(
                        alignment: Alignment.topLeft,
                        margin: EdgeInsets.only(
                            top: MyDimens.dimen40, left: MyDimens.dimen12),
                        width: MyDimens.dimen245,
                        child: Text(
                          // 'ขั้นตอนการลงทะเบียนผู้ขาย',
                          'ข้อมูลผู้ขาย', textAlign: TextAlign.left,
                          style: MyFont.regular16.copyWith(color: Colors.white),
                        ),
                      ),
                      Container(
                        alignment: Alignment.center,
                        margin: EdgeInsets.only(
                            top: MyDimens.dimen46, left: MyDimens.dimen160),
                        child: Text(
                          this.myLang == 'th' || this.myLang == ""
                              ? 'ดูข้อมูลผู้ขาย'
                              : 'Detail',
                          textAlign: TextAlign.center,
                          style: MyFont.medium14.copyWith(color: Colors.white),
                        ),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(20),
                          color: Color.fromRGBO(241, 91, 68, 1),
                        ),
                        height: MyDimens.dimen30,
                        width: MyDimens.dimen100,
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
          GestureDetector(
            onTap: () async {
              NavigatorUtil.pushToPage(
                WebViewScreen(
                  title: this.myLang == 'th' || this.myLang == ""
                      ? 'การเสนอซื้อ'
                      : "Purchase List",
                  url: getIt.get<AppFlavorData>().webDomain +
                      '/offer?mobile=1&lang=${this.myLang}',
                ),
              );
            },
            child: Container(
              alignment: Alignment.center,
              margin: EdgeInsets.only(top: MyDimens.dimen24, left: 0),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(24),
                color: Color.fromRGBO(2, 29, 79, 1),
              ),
              width: MediaQuery.of(context).size.width,
              height: MyDimens.dimen100,
              child: Row(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 0, left: MyDimens.dimen24),
                    child: Icon(
                      Icons.back_hand,
                      color: Colors.white,
                      size: MyDimens.dimen46,
                    ),
                  ),
                  Stack(
                    children: [
                      Container(
                        margin: EdgeInsets.only(
                            top: MyDimens.dimen14, left: MyDimens.dimen12),
                        child: Text(
                          'Purchase List',
                          style: MyFont.regular20.copyWith(color: Colors.white),
                        ),
                      ),
                      Container(
                        alignment: Alignment.topLeft,
                        margin: EdgeInsets.only(
                            top: MyDimens.dimen40, left: MyDimens.dimen12),
                        width: MyDimens.dimen245,
                        child: Text(
                          // 'ขั้นตอนการลงทะเบียนผู้ขาย',
                          'เสนอซื้อ', textAlign: TextAlign.left,
                          style: MyFont.regular16.copyWith(color: Colors.white),
                        ),
                      ),
                      Container(
                        alignment: Alignment.center,
                        margin: EdgeInsets.only(
                          top: MyDimens.dimen46,
                          left: MyDimens.dimen160,
                        ),
                        child: Text(
                          this.myLang == 'th' || this.myLang == ""
                              ? 'ดูเสนอซื้อ'
                              : "Detail",
                          textAlign: TextAlign.center,
                          style: MyFont.medium14.copyWith(color: Colors.white),
                        ),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(20),
                          color: Color.fromRGBO(241, 91, 68, 1),
                        ),
                        height: MyDimens.dimen30,
                        width: MyDimens.dimen100,
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),

          // GestureDetector(
          //   onTap: () async {
          //     if (await canLaunchUrlString(
          //         getIt.get<AppFlavorData>().webDomain + '/ipmartadm')) {
          //       launchUrlString(
          //         getIt.get<AppFlavorData>().webDomain + '/ipmartadm',
          //         mode: LaunchMode.externalApplication,
          //       );
          //     }
          //   },
          //   child: Image.asset(
          //     "assets/images/img_business_matching.png",
          //   ),
          // ),
          // SizedBox(height: MyDimens.dimen14),
          // Row(
          //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
          //   children: [
          //     GestureDetector(
          //       onTap: () async {
          //         NavigatorUtil.pushToPage(
          //           WebViewScreen(
          //             title: this.myLang == 'th' || this.myLang == ""
          //                 ? 'การเสนอซื้อ'
          //                 : "Purchase List",
          //             url: getIt.get<AppFlavorData>().webDomain +
          //                 '/offer?mobile=1&lang=${this.myLang}',
          //           ),
          //         );
          //       },
          //       child: Image.asset(
          //         "assets/images/img_offer_btn.png",
          //         width: MyDimens.dimen164,
          //       ),
          //     ),
          //     GestureDetector(
          //       onTap: () async {
          //         // print("sakod ${this.myLang}");
          //         NavigatorUtil.pushToPage(
          //           WebViewScreen(
          //             title: this.myLang == 'th' || this.myLang == ""
          //                 ? 'ข้อมูลผู้ขาย'
          //                 : "Seller Information",
          //             url: getIt.get<AppFlavorData>().webDomain +
          //                 '/sellers-list?mobile=1&lang=${this.myLang}',
          //           ),
          //         );
          //       },
          //       child: Image.asset(
          //         "assets/images/img_seller_list_btn.png",
          //         width: MyDimens.dimen164,
          //         colorBlendMode: BlendMode.overlay,
          //       ),
          //     ),
          //   ],
          // ),
        ],
      ),
    );
  }
}
