import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/config/dependencies.dart';
import 'package:mc_common_app/config/routes.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

import '../../theme/colors.dart';

class RegisterSelectionPage extends StatelessWidget {
  const RegisterSelectionPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    AppState appState = injector.get<AppState>();
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage(MyAssets.bnIntroPng),
            fit: BoxFit.cover,
          ),
        ),
        child: Column(
          children: [
            Utils.mFlex(6),
            SvgPicture.asset(MyAssets.logo),
            Utils.mFlex(4),
            LocaleKeys.welcomeMessage.tr().toText(
                  fontSize: 20,
                  letterSpacing: -1.44,
                ),
            LocaleKeys.welcomeDes.tr().toText(
                  color: MyColors.lightTextColor,
                  fontSize: 14,
                  height: 23 / 24,
                  letterSpacing: -0.48,
                ),
            Utils.mFlex(1),
            ShowFillButton(
              title: LocaleKeys.login.tr(),
              maxWidth: double.infinity,
              horizontalMargin: 20,
              onPressed: () {
                navigateWithName(context, AppRoutes.loginWithPassword);
              },
            ),
            20.height,
            ShowFillButton(
              title: LocaleKeys.signUp.tr(),
              maxWidth: double.infinity,
              isFlatButton: true,
              txtColor: Colors.black,
              onPressed: () {
                if (appState.currentAppType == AppType.customer) {
                  navigateWithName(context, AppRoutes.registerCustomer);
                } else {
                  navigateWithName(context, AppRoutes.registerProvider);
                }
              },
            ),
            10.height,
            Utils.mFlex(3),
            TextButton(
              onPressed: () {},
              child: const Text(
                "Continue as Guest",
                style: TextStyle(
                  color: MyColors.darkPrimaryColor,
                  fontWeight: FontWeight.bold,
                  decoration: TextDecoration.underline,
                ),
              ),
            ),
            Utils.mFlex(3),
          ],
        ),
      ),
    );
  }
}
