content: import 'package:flutter/material.dart';
  import 'package:get/get.dart';
  import 'package:t_store/data/repositories/authentication/authentication_repository.dart';
  import 'package:t_store/features/authentication/screens/password_configuration/reset_password.dart';
  import 'package:t_store/utils/constraints/image_strings.dart';
  import 'package:t_store/utils/helpers/loaders.dart';
  import 'package:t_store/utils/helpers/network_manager.dart';
  import 'package:t_store/utils/popups/full_screen_loader.dart';
  
  class ForgetPasswordController extends GetxController {
    static ForgetPasswordController get instance => Get.find();
  
    ///variables
    final email = TextEditingController();
    GlobalKey<FormState> forgetPasswordFormKey = GlobalKey<FormState>();
  
    ///send reset password email
    sendPasswordResetEmail() async {
      try{
  
        //start loading
        TFullScreenLoader.openLoadingDialog('Processing your request...', TImages.docerAnimation);
  
        //check internet connectivity
        final isConnected = await NetworkManager.instance.isConnected();
        if(!isConnected){
          TFullScreenLoader.stopLoading();
          return;
        }
  
        //form validation
        if(!forgetPasswordFormKey.currentState!.validate()) {
          TFullScreenLoader.stopLoading();
          return;
        }
  
        //send email to reset password
        await AuthenticationRepository.instance.sendPasswordResetEmail(email.text.trim());
  
        //remove loader
        TFullScreenLoader.stopLoading();
  
        //show success screen
        TLoaders.successSnackBar(title: 'Email sent', message: 'Email link sent to reset your password'.tr);
  
        //redirect
        Get.to(() => ResetPasswordScreen(email: email.text.trim()));
      } catch (e) {
        //remove loader
        TFullScreenLoader.stopLoading();
        TLoaders.errorSnackBar(title: 'Oh snap', message: e.toString());
      }
    }
  
    resendPasswordResetEmail(String email) async {
      try{
  
        //start loading
        TFullScreenLoader.openLoadingDialog('Processing your request...', TImages.docerAnimation);
  
        //check internet connectivity
        final isConnected = await NetworkManager.instance.isConnected();
        if(!isConnected){
          TFullScreenLoader.stopLoading();
          return;
        }
  
  
        //send email to reset password
        await AuthenticationRepository.instance.sendPasswordResetEmail(email);
  
        //remove loader
        TFullScreenLoader.stopLoading();
  
        //show success screen
        TLoaders.successSnackBar(title: 'Email sent', message: 'Email link sent to reset your password'.tr);
  
  
  
      } catch (e) {
        //remove loader
        TFullScreenLoader.stopLoading();
        TLoaders.errorSnackBar(title: 'Oh snap', message: e.toString());
      }
    }
  }