import 'package:e_commerce_training/res/R.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';

class ImiClubStandard extends StatefulWidget {
  const ImiClubStandard({Key? key}) : super(key: key);

  @override
  _ImiClubStandardState createState() => _ImiClubStandardState();
}

class _ImiClubStandardState extends State<ImiClubStandard> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("IMI CLUB STANDARD"),
      ),
      body: buildPage3(),
    );
  }

  Widget buildPage1() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: 30),
        Center(
          child: Image.asset(
            R.drawable.icSilver,
            height: 60.h,
            width: 60.h,
          ),
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(MdiIcons.checkCircle, color: R.color.green, size: 30.h),
            SizedBox(width: 10),
            Text(
              R.string.activated.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.green,
              ),
            )
          ],
        ),
        SizedBox(height: 10),
        Text(
          R.string.imi_club_standard.tr(),
          style: TextStyle(
            fontSize: 22.sp,
            fontWeight: FontWeight.w600,
            color: R.color.black,
          ),
        ),
        SizedBox(height: 10),
        RichText(
          text: TextSpan(
              text: R.string.expiration_date.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                color: R.color.gray,
                fontWeight: FontWeight.w600,
              ),
              children: <TextSpan>[
                TextSpan(
                  text: " 11/07/2021",
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: R.color.gray,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ]),
        ),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_dedicated_club_province_events.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.limited_access_to_other_clubs.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_imi_networks.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.discounted_on_services.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.insurance_included.tr()),
      ],
    );
  }

  Widget buildPage2() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: 30),
        Center(
          child: Image.asset(
            R.drawable.icSilver,
            height: 60.h,
            width: 60.h,
          ),
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(MdiIcons.compareHorizontal, color: R.color.orange, size: 30.h),
            SizedBox(width: 10),
            Text(
              R.string.waiting_for_approval.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.orange,
              ),
            )
          ],
        ),
        SizedBox(height: 10),
        Text(
          R.string.imi_club_standard.tr(),
          style: TextStyle(
            fontSize: 22.sp,
            fontWeight: FontWeight.w600,
            color: R.color.black,
          ),
        ),
        SizedBox(height: 10),
        SizedBox(
          width: 250.w,
          child: Text(
            R.string.in_case_of_overdue.tr(),
            style: TextStyle(
              fontSize: 16.sp,
              fontWeight: FontWeight.w600,
              color: R.color.gray,
            ),
            textAlign: TextAlign.center,
            maxLines: 2,
          ),
        ),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_dedicated_club_province_events.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.limited_access_to_other_clubs.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_imi_networks.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.discounted_on_services.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.insurance_included.tr()),
      ],
    );
  }

  Widget buildPage3() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: 30),
        Center(
          child: Image.asset(
            R.drawable.icSilver,
            height: 60.h,
            width: 60.h,
          ),
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(MdiIcons.alertCircle, color: R.color.red, size: 30.h),
            SizedBox(width: 10),
            Text(
              R.string.expired.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.red,
              ),
            )
          ],
        ),
        SizedBox(height: 10),
        Text(
          R.string.imi_club_standard.tr(),
          style: TextStyle(
            fontSize: 22.sp,
            fontWeight: FontWeight.w600,
            color: R.color.black,
          ),
        ),
        SizedBox(height: 10),
        SizedBox(
          width: 250.w,
          child: Text(
            R.string.in_case_of_overdue.tr(),
            style: TextStyle(
              fontSize: 16.sp,
              fontWeight: FontWeight.w600,
              color: R.color.gray,
            ),
            textAlign: TextAlign.center,
            maxLines: 2,
          ),
        ),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_dedicated_club_province_events.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.limited_access_to_other_clubs.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.unlimited_access_to_imi_networks.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.discounted_on_services.tr()),
        SizedBox(height: 20),
        buildRowText(title: R.string.insurance_included.tr()),
      ],
    );
  }

  Padding buildRowText({String? title}) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 40),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Icon(MdiIcons.star, size: 20.h, color: R.color.gray),
          SizedBox(width: 10),
          Expanded(
            child: Text(
              title ?? "",
              style: TextStyle(
                fontSize: 16.h,
                fontWeight: FontWeight.w600,
                color: R.color.black,
              ),
              maxLines: 2,
            ),
          ),
        ],
      ),
    );
  }
}
