
import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/generated/l10n.dart';
import 'package:flutter_wisetronic/widgets/general/text_link.dart';

import '../../constants.dart';

class DesktopIndexMainContent3 extends StatefulWidget {
  final Map<String, dynamic> content;
  const DesktopIndexMainContent3(this.content, {Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return DesktopIndexMainContent3State();
  }
}

class DesktopIndexMainContent3State extends State<DesktopIndexMainContent3> {
  double sideSpace = 0;
  double mainSpace = 1200;

  @override
  Widget build(BuildContext context) {
    if (widget.content == null) {
      return Container();
    }
    if (MediaQuery.of(context).size.width <= 1200) {
      mainSpace = MediaQuery.of(context).size.width;
      sideSpace = 0;
    } else {
      mainSpace = 1200;
      sideSpace = (MediaQuery.of(context).size.width - 1200) / 2;
    }
    return Container(
      width: MediaQuery.of(context).size.width,
      margin: EdgeInsets.only(top: 20.0),
      padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 0.0),
      decoration: BoxDecoration(
        color: Color(0xff262626),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            width: sideSpace,
          ),
          Container(
            width: mainSpace,
            child: _getBody2(),
          ),
          Container(
            width: sideSpace,
          ),
        ],
      ),
    );
  }

  Column _getBody() {
    Column col;
    col = Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          child: Text(
            S.of(context).information,
            style: TextStyle(
              fontSize: 16.0,
              fontWeight: FontWeight.bold,
              color: Colors.white70,
            ),
          ),
        ),
        Container(
          child: Row(
            children: [
              TextLink(S.of(context).service_policy, '/service-policy', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).return_policy, '/return-policy', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).privacy_policy, '/privacy-policy', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).license_agreement, '/end-user-license-agreement', paddingVertical: 5.0, paddingHorizontal: 10.0,)
            ],
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 12.0),
          child: Text(
            S.of(context).support,
            style: TextStyle(
              fontSize: 16.0,
              fontWeight: FontWeight.bold,
              color: Colors.white70,
            ),
          ),
        ),
        Container(
          child: Row(
            children: [
              TextLink(S.of(context).wiki, '/wiki', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).support_ticket, '/my-support/${Constants.BUSINESS_ID}', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).contact_us, '/contact-us', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).about_us, '/about-us', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).renew_license, '/renew-license', paddingVertical: 5.0, paddingHorizontal: 10.0,),
              TextLink(S.of(context).create_a_online_store, '/contact-stores', paddingVertical: 5.0, paddingHorizontal: 10.0,)
            ],
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 12.0),
          child: Text(
            S.of(context).developer_of,
            style: TextStyle(
              fontSize: 16.0,
              fontWeight: FontWeight.bold,
              color: Colors.white70,
            ),
          ),
        ),
        Container(
          child: Row(
            children: [
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_GOOGLE,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_ALEXA,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_APPLE,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_EBAY,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_QUICKBOOKS,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
              Container(
                padding: EdgeInsets.all(10.0),
                child: Icon(
                  IconData(
                      Constants.FONT_SHOPIFY,
                      fontFamily: 'wisetronic',
                      fontPackage: null
                  ),
                  color: Colors.white24,
                  size: 48.0,
                ),
              ),
            ],
          ),
        ),
      ],
    );
    return col;
  }

  Row _getBody2() {
    Row row;
    row = Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          width: mainSpace / 10 * 3,
          padding: EdgeInsets.only(left: 16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                child: Text(
                  S.of(context).information,
                  style: TextStyle(
                    fontSize: 18.0,
                    fontWeight: FontWeight.bold,
                    color: Colors.white70,
                  ),
                ),
              ),
              TextLink(S.of(context).service_policy, '/service-policy', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).return_policy, '/return-policy', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).privacy_policy, '/privacy-policy', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).license_agreement, '/end-user-license-agreement', paddingVertical: 5.0, paddingHorizontal: 0.0,)
            ],
          ),
        ),
        Container(
          width: mainSpace / 10 * 3,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                margin: EdgeInsets.only(top: 0.0),
                child: Text(
                  S.of(context).support,
                  style: TextStyle(
                    fontSize: 18.0,
                    fontWeight: FontWeight.bold,
                    color: Colors.white70,
                  ),
                ),
              ),
              TextLink(S.of(context).wiki, '/wiki', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).support_ticket, '/my-support/${Constants.BUSINESS_ID}', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).contact_us, '/contact-us', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).about_us, '/about-us', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).renew_license, '/renew-license', paddingVertical: 5.0, paddingHorizontal: 0.0,),
              TextLink(S.of(context).create_a_online_store, '/contact-stores', paddingVertical: 5.0, paddingHorizontal: 0.0,)
            ],
          ),
        ),
        Container(
          width: mainSpace / 10 * 4,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                margin: EdgeInsets.only(top: 0.0),
                child: Text(
                  S.of(context).developer_of,
                  style: TextStyle(
                    fontSize: 18.0,
                    fontWeight: FontWeight.bold,
                    color: Colors.white70,
                  ),
                ),
              ),
              Wrap(
                children: [
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_GOOGLE,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_ALEXA,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_APPLE,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_EBAY,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_QUICKBOOKS,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.all(10.0),
                    child: Icon(
                      IconData(
                          Constants.FONT_SHOPIFY,
                          fontFamily: 'wisetronic',
                          fontPackage: null
                      ),
                      color: Colors.white24,
                      size: 48.0,
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ],
    );
    return row;
  }

}