buildOnStateChange method

Widget buildOnStateChange(
  1. BuildContext context,
  2. OTPProvider otpProvider
)

Implementation

Widget buildOnStateChange(BuildContext context, OTPProvider otpProvider) {
  if (otpProvider.otpState == OTPState.OTP_SENT) {
    return otpSentWidget;
  } else if (otpProvider.otpState == OTPState.FIRST_LOGIN) {
    var userProvider = Provider.of<UserProvider>(context, listen: false);

    if (userProvider.userFetched != null) {
      if (userProvider.userFetched!.firstLogin) {
        return firstLoginWidget;
      } else {
        logger.d("2 Factor Authenticated!!! TWO FACTOR 2fa");
        Provider.of<AuthProvider>(context, listen: false)
            .is2FactorAuthenticated = true;
      }
    }
  }

  return phoneInputWidget;
}