@ -40,18 +40,17 @@ import 'package:flutter_svg/flutter_svg.dart';
import ' package:intl/intl.dart ' ;
import ' package:intl/intl.dart ' ;
import ' package:local_auth/local_auth.dart ' ;
import ' package:local_auth/local_auth.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:local_auth_ ios/local_auth _ios.dart' ;
import ' package:local_auth_ darwin/types/auth_messages _ios.dart' ;
class ConfirmLogin extends StatefulWidget {
class ConfirmLogin extends StatefulWidget {
final Function ? changePageViewIndex ;
final Function ? changePageViewIndex ;
final fromRegistration ;
final fromRegistration ;
final bool isDubai ;
final bool isDubai ;
const ConfirmLogin (
const ConfirmLogin ( { Key ? key ,
{ Key ? key ,
this . changePageViewIndex ,
this . changePageViewIndex ,
this . fromRegistration = false ,
this . fromRegistration = false ,
this . isDubai = false } )
this . isDubai = false } )
: super ( key: key ) ;
: super ( key: key ) ;
@ override
@ override
@ -65,7 +64,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
bool authenticated = false ;
bool authenticated = false ;
final authService = AuthProvider ( ) ;
final authService = AuthProvider ( ) ;
PharmacyModuleViewModel pharmacyModuleViewModel =
PharmacyModuleViewModel pharmacyModuleViewModel =
locator < PharmacyModuleViewModel > ( ) ;
locator < PharmacyModuleViewModel > ( ) ;
late int mobileNumber ;
late int mobileNumber ;
String errorMsg = ' ' ;
String errorMsg = ' ' ;
SelectDeviceIMEIRES ? user ;
SelectDeviceIMEIRES ? user ;
@ -96,9 +95,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
int fingrePrintBefore = 0 ;
int fingrePrintBefore = 0 ;
AuthenticatedUserObject authenticatedUserObject =
AuthenticatedUserObject authenticatedUserObject =
locator < AuthenticatedUserObject > ( ) ;
locator < AuthenticatedUserObject > ( ) ;
AppointmentRateViewModel appointmentRateViewModel =
AppointmentRateViewModel appointmentRateViewModel =
locator < AppointmentRateViewModel > ( ) ;
locator < AppointmentRateViewModel > ( ) ;
late ProjectViewModel projectViewModel ;
late ProjectViewModel projectViewModel ;
late ToDoCountProviderModel toDoProvider ;
late ToDoCountProviderModel toDoProvider ;
@ -145,7 +144,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
Text (
Text (
TranslationBase . of ( context ) . welcomeBack ,
TranslationBase
. of ( context )
. welcomeBack ,
style: TextStyle (
style: TextStyle (
fontSize: 12 ,
fontSize: 12 ,
fontWeight: FontWeight . w600 ,
fontWeight: FontWeight . w600 ,
@ -163,7 +164,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
SizedBox ( height: 10 ) ,
SizedBox ( height: 10 ) ,
Text (
Text (
TranslationBase . of ( context ) . accountInfo ,
TranslationBase
. of ( context )
. accountInfo ,
style: TextStyle (
style: TextStyle (
fontSize: 16 ,
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
fontWeight: FontWeight . w600 ,
@ -189,11 +192,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
children: [
children: [
Row (
Row (
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
MainAxisAlignment . spaceBetween ,
crossAxisAlignment: CrossAxisAlignment . center ,
crossAxisAlignment: CrossAxisAlignment . center ,
children: [
children: [
Text (
Text (
TranslationBase . of ( context )
TranslationBase
. of ( context )
. lastLoginAt
. lastLoginAt
. toCamelCase ,
. toCamelCase ,
style: TextStyle (
style: TextStyle (
@ -208,8 +212,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
/ / :
/ / :
user ! . createdOn ! = null
user ! . createdOn ! = null
? DateUtil . getDayMonthYearDateFormatted (
? DateUtil . getDayMonthYearDateFormatted (
DateUtil . convertStringToDate (
DateUtil . convertStringToDate (
user ! . createdOn ! ) )
user ! . createdOn ! ) )
: ' -- ' ,
: ' -- ' ,
style: TextStyle (
style: TextStyle (
fontSize: 12 ,
fontSize: 12 ,
@ -221,11 +225,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
Row (
Row (
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
MainAxisAlignment . spaceBetween ,
crossAxisAlignment: CrossAxisAlignment . center ,
crossAxisAlignment: CrossAxisAlignment . center ,
children: [
children: [
Text (
Text (
TranslationBase . of ( context )
TranslationBase
. of ( context )
. lastLoginWith
. lastLoginWith
. toCamelCase ,
. toCamelCase ,
style: TextStyle (
style: TextStyle (
@ -252,9 +257,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
/ / :
/ / :
user ! . createdOn ! = null
user ! . createdOn ! = null
? DateUtil . formatDateToTimeLang (
? DateUtil . formatDateToTimeLang (
DateUtil . convertStringToDate (
DateUtil . convertStringToDate (
user ! . createdOn ! ) ,
user ! . createdOn ! ) ,
false )
false )
: ' -- ' ,
: ' -- ' ,
style: TextStyle (
style: TextStyle (
fontSize: 12 ,
fontSize: 12 ,
@ -268,7 +273,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
) ,
) ,
Text (
Text (
TranslationBase . of ( context ) . pleaseVerify ,
TranslationBase
. of ( context )
. pleaseVerify ,
style: TextStyle (
style: TextStyle (
fontSize: 16 ,
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
fontWeight: FontWeight . w600 ,
@ -277,10 +284,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
GridView (
GridView (
gridDelegate:
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount (
SliverGridDelegateWithFixedCrossAxisCount (
crossAxisCount: 2 ,
crossAxisCount: 2 ,
crossAxisSpacing: 13 ,
crossAxisSpacing: 13 ,
mainAxisSpacing: 9 ) ,
mainAxisSpacing: 9 ) ,
physics: NeverScrollableScrollPhysics ( ) ,
physics: NeverScrollableScrollPhysics ( ) ,
padding: EdgeInsets . only ( top: 9 ) ,
padding: EdgeInsets . only ( top: 9 ) ,
shrinkWrap: true ,
shrinkWrap: true ,
@ -306,27 +313,32 @@ class _ConfirmLogin extends State<ConfirmLogin> {
SizedBox ( height: 23 ) ,
SizedBox ( height: 23 ) ,
this . onlySMSBox = = false
this . onlySMSBox = = false
? Text (
? Text (
TranslationBase . of ( context ) . verifyLoginWith ,
TranslationBase
style: TextStyle (
. of ( context )
fontSize: 16 ,
. verifyLoginWith ,
fontWeight: FontWeight . w600 ,
style: TextStyle (
color: Color ( 0xff2B353E ) ,
fontSize: 16 ,
letterSpacing: - 0.64 ,
fontWeight: FontWeight . w600 ,
height: 25 / 16 ) ,
color: Color ( 0xff2B353E ) ,
)
letterSpacing: - 0.64 ,
height: 25 / 16 ) ,
)
: Text (
: Text (
TranslationBase . of ( context )
TranslationBase
. verifyFingerprint2 ,
. of ( context )
style: TextStyle (
. verifyFingerprint2 ,
fontSize: 16 ,
style: TextStyle (
fontWeight: FontWeight . w600 ,
fontSize: 16 ,
color: Color ( 0xff2B353E ) ,
fontWeight: FontWeight . w600 ,
letterSpacing: - 0.64 ,
color: Color ( 0xff2B353E ) ,
height: 25 / 16 ) ,
letterSpacing: - 0.64 ,
) ,
height: 25 / 16 ) ,
) ,
SizedBox ( height: 23 ) ,
SizedBox ( height: 23 ) ,
Text (
Text (
TranslationBase . of ( context ) . pleaseVerify ,
TranslationBase
. of ( context )
. pleaseVerify ,
style: TextStyle (
style: TextStyle (
fontSize: 16 ,
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
fontWeight: FontWeight . w600 ,
@ -335,10 +347,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
GridView (
GridView (
gridDelegate:
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount (
SliverGridDelegateWithFixedCrossAxisCount (
crossAxisCount: 2 ,
crossAxisCount: 2 ,
crossAxisSpacing: 13 ,
crossAxisSpacing: 13 ,
mainAxisSpacing: 9 ) ,
mainAxisSpacing: 9 ) ,
physics: NeverScrollableScrollPhysics ( ) ,
physics: NeverScrollableScrollPhysics ( ) ,
padding: EdgeInsets . only ( top: 9 ) ,
padding: EdgeInsets . only ( top: 9 ) ,
shrinkWrap: true ,
shrinkWrap: true ,
@ -357,8 +369,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
height: 12 ,
height: 12 ,
) ,
) ,
DefaultButton (
DefaultButton (
TranslationBase . of ( context ) . useAnotherAccount ,
TranslationBase
( ) {
. of ( context )
. useAnotherAccount ,
( ) {
Navigator . of ( context ) . pushNamed ( LOGIN_TYPE ) ;
Navigator . of ( context ) . pushNamed ( LOGIN_TYPE ) ;
projectViewModel . analytics . loginRegistration
projectViewModel . analytics . loginRegistration
. login_with_other_account ( ) ;
. login_with_other_account ( ) ;
@ -450,22 +464,23 @@ class _ConfirmLogin extends State<ConfirmLogin> {
sharedPref . setObject ( REGISTER_DATA_FOR_REGISTER , request ) ;
sharedPref . setObject ( REGISTER_DATA_FOR_REGISTER , request ) ;
authService
authService
. checkPatientAuthentication ( request )
. checkPatientAuthentication ( request )
. then ( ( value ) = > {
. then ( ( value ) = >
GifLoaderDialogUtils . hideDialog ( context ) ,
{
if ( value [ ' isSMSSent ' ] )
GifLoaderDialogUtils . hideDialog ( context ) ,
{
if ( value [ ' isSMSSent ' ] )
sharedPref . setString ( LOGIN_TOKEN_ID , value [ ' LogInTokenID ' ] ) ,
{
this . loginTokenID = value [ ' LogInTokenID ' ] ,
sharedPref . setString ( LOGIN_TOKEN_ID , value [ ' LogInTokenID ' ] ) ,
sharedPref . setObject ( REGISTER_DATA_FOR_LOGIIN , request ) ,
this . loginTokenID = value [ ' LogInTokenID ' ] ,
/ / Future . delayed ( Duration ( seconds: 1 ) , ( ) {
sharedPref . setObject ( REGISTER_DATA_FOR_LOGIIN , request ) ,
this . sendActivationCode ( type )
/ / Future . delayed ( Duration ( seconds: 1 ) , ( ) {
/ / } )
this . sendActivationCode ( type )
}
/ / } )
else
}
{
else
if ( value [ ' IsAuthenticated ' ] ) { this . checkActivationCode ( ) }
{
}
if ( value [ ' IsAuthenticated ' ] ) { this . checkActivationCode ( ) }
} )
}
} )
. catchError ( ( err ) {
. catchError ( ( err ) {
print ( err ) ;
print ( err ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -516,10 +531,11 @@ class _ConfirmLogin extends State<ConfirmLogin> {
context ,
context ,
type ,
type ,
this . mobileNumber ,
this . mobileNumber ,
( value ) {
( value ) {
this . checkActivationCode ( value: value ) ;
this . checkActivationCode ( value: value ) ;
} ,
} ,
( ) = > {
( ) = >
{
Navigator . pop ( context ) ,
Navigator . pop ( context ) ,
} ,
} ,
) . displayDialog ( context ) ;
) . displayDialog ( context ) ;
@ -611,12 +627,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this . zipCode = this . registerd_data ! = null
this . zipCode = this . registerd_data ! = null
? this . registerd_data . zipCode
? this . registerd_data . zipCode
: this . user ! . outSA = = true
: this . user ! . outSA = = true
? " 971 "
? " 971 "
: " 966 " ;
: " 966 " ;
this . patientOutSA = this . registerd_data ! = null
this . patientOutSA = this . registerd_data ! = null
? this . registerd_data . zipCode = = " 966 "
? this . registerd_data . zipCode = = " 966 "
? 0
? 0
: 1
: 1
: this . user ! . outSA ;
: this . user ! . outSA ;
if ( this . registerd_data ! = null ) {
if ( this . registerd_data ! = null ) {
this . loginTokenID = await sharedPref . getString ( LOGIN_TOKEN_ID ) ;
this . loginTokenID = await sharedPref . getString ( LOGIN_TOKEN_ID ) ;
@ -637,8 +653,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this . lastLogin = await sharedPref . getInt ( LAST_LOGIN ) ! = null
this . lastLogin = await sharedPref . getInt ( LAST_LOGIN ) ! = null
? await sharedPref . getInt ( LAST_LOGIN )
? await sharedPref . getInt ( LAST_LOGIN )
: user ! = null
: user ! = null
? user ! . logInType
? user ! . logInType
: null ;
: null ;
showLoader ( false ) ;
showLoader ( false ) ;
/ / this . cs . sharedService . getStorage ( AuthenticationService . LAST_LOGIN ) ;
/ / this . cs . sharedService . getStorage ( AuthenticationService . LAST_LOGIN ) ;
@ -652,7 +668,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
request . projectOutSA = this . patientOutSA = = true ? true : false ;
request . projectOutSA = this . patientOutSA = = true ? true : false ;
request . loginType = this . selectedOption ;
request . loginType = this . selectedOption ;
request . oTPSendType =
request . oTPSendType =
type = = 1 ? type : 2 ; / / this . selectedOption = = 1 ? 1 : 2 ;
type = = 1 ? type : 2 ; / / this . selectedOption = = 1 ? 1 : 2 ;
request . zipCode = this . zipCode ;
request . zipCode = this . zipCode ;
request . logInTokenID = this . loginTokenID ? ? " " ;
request . logInTokenID = this . loginTokenID ? ? " " ;
@ -665,17 +681,17 @@ class _ConfirmLogin extends State<ConfirmLogin> {
? this . registerd_data . patientID
? this . registerd_data . patientID
: 0 ;
: 0 ;
request . patientIdentificationID = request . nationalID =
request . patientIdentificationID = request . nationalID =
this . registerd_data . patientIdentificationID ! = null
this . registerd_data . patientIdentificationID ! = null
? this . registerd_data . patientIdentificationID
? this . registerd_data . patientIdentificationID
: ' 0 ' ;
: ' 0 ' ;
request . dob = this . registerd_data . dob ;
request . dob = this . registerd_data . dob ;
request . isRegister = this . registerd_data . isRegister ;
request . isRegister = this . registerd_data . isRegister ;
} else {
} else {
request . searchType = request . searchType ! = null ? request . searchType : 2 ;
request . searchType = request . searchType ! = null ? request . searchType : 2 ;
request . patientID =
request . patientID =
this . user ! . patientID ! = null ? this . user ! . patientID : 0 ;
this . user ! . patientID ! = null ? this . user ! . patientID : 0 ;
request . nationalID =
request . nationalID =
request . nationalID ! = null ? request . nationalID : ' 0 ' ;
request . nationalID ! = null ? request . nationalID : ' 0 ' ;
request . patientIdentificationID = request . patientIdentificationID ! = null
request . patientIdentificationID = request . patientIdentificationID ! = null
? request . patientIdentificationID
? request . patientIdentificationID
: ' 0 ' ;
: ' 0 ' ;
@ -699,39 +715,40 @@ class _ConfirmLogin extends State<ConfirmLogin> {
authService
authService
. checkActivationCodeRegister ( request , value )
. checkActivationCodeRegister ( request , value )
. then ( ( result ) = > {
. then ( ( result ) = >
res = result ,
{
if ( result is Map )
res = result ,
{
if ( result is Map )
result = CheckActivationCode . fromJson (
{
result as Map < String , dynamic > ) ,
result = CheckActivationCode . fromJson (
if ( this . registerd_data ! = null & &
result as Map < String , dynamic > ) ,
this . registerd_data . isRegister = = true )
if ( this . registerd_data ! = null & &
{
this . registerd_data . isRegister = = true )
/ / if ( widget . isDubai = = false ) {
{
widget . changePageViewIndex ! ( 1 ) ,
/ / if ( widget . isDubai = = false ) {
/ / if ( widget . isDubai = = false ) {
widget . changePageViewIndex ! ( 1 ) ,
/ / if ( widget . isDubai = = false ) {
Navigator . popUntil (
context ,
Navigator . popUntil (
( route ) = >
context ,
Utils . route ( route , equalsTo: RegisterNew ) ) ,
( route ) = >
}
Utils . route ( route , equalsTo: RegisterNew ) ) ,
}
}
else
}
{
else
/ / Navigator . of ( context ) . pop ( ) ,
{
GifLoaderDialogUtils . hideDialog ( context ) ,
/ / Navigator . of ( context ) . pop ( ) ,
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
GifLoaderDialogUtils . hideDialog ( context ) ,
AppToast . showErrorToast ( message: result ) ;
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
} ) ,
AppToast . showErrorToast ( message: result ) ;
projectViewModel . analytics . loginRegistration
} ) ,
. login_fail ( error: result ) ,
projectViewModel . analytics . loginRegistration
projectViewModel . analytics . errorTracking . log (
. login_fail ( error: result ) ,
' otp_verification_at_confirm_login ' ,
projectViewModel . analytics . errorTracking . log (
error: result ) ,
' otp_verification_at_confirm_login ' ,
}
error: result ) ,
} )
}
} )
. catchError ( ( err ) {
. catchError ( ( err ) {
print ( err ) ;
print ( err ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -743,58 +760,59 @@ class _ConfirmLogin extends State<ConfirmLogin> {
} else {
} else {
authService
authService
. checkActivationCode ( request , value )
. checkActivationCode ( request , value )
. then ( ( result ) = > {
. then ( ( result ) = >
res = result ,
{
if ( result is Map )
res = result ,
{
if ( result is Map )
result = CheckActivationCode . fromJson (
{
result as Map < String , dynamic > ) ,
result = CheckActivationCode . fromJson (
if ( this . registerd_data ! = null & &
result as Map < String , dynamic > ) ,
this . registerd_data . isRegister = = true )
if ( this . registerd_data ! = null & &
{
this . registerd_data . isRegister = = true )
widget . changePageViewIndex ! ( 1 ) ,
{
Navigator . popUntil (
widget . changePageViewIndex ! ( 1 ) ,
context ,
Navigator . popUntil (
( route ) = >
context ,
Utils . route ( route , equalsTo: RegisterNew ) ) ,
( route ) = >
}
Utils . route ( route , equalsTo: RegisterNew ) ) ,
else
}
{
else
sharedPref . remove ( FAMILY_FILE ) ,
{
result . list . isFamily = false ,
sharedPref . remove ( FAMILY_FILE ) ,
userData = result . list ,
result . list . isFamily = false ,
sharedPref . setString (
userData = result . list ,
BLOOD_TYPE , result . patientBloodType ? ? " O+ " ) ,
sharedPref . setString (
/ / Remove o + from here Added by Aamir
BLOOD_TYPE , result . patientBloodType ? ? " O+ " ) ,
authenticatedUserObject . user = result . list ,
/ / Remove o + from here Added by Aamir
projectViewModel . setPrivilege ( privilegeList: res ) ,
authenticatedUserObject . user = result . list ,
sharedPref . setObject ( MAIN_USER , result . list ) ,
projectViewModel . setPrivilege ( privilegeList: res ) ,
sharedPref . setObject ( USER_PROFILE , result . list ) ,
sharedPref . setObject ( MAIN_USER , result . list ) ,
loginTokenID = result . logInTokenID ,
sharedPref . setObject ( USER_PROFILE , result . list ) ,
sharedPref . setObject (
loginTokenID = result . logInTokenID ,
LOGIN_TOKEN_ID , result . logInTokenID ) ,
sharedPref . setObject (
sharedPref . setString (
LOGIN_TOKEN_ID , result . logInTokenID ) ,
TOKEN , result . authenticationTokenID ) ,
sharedPref . setString (
projectViewModel . analytics . loginRegistration
TOKEN , result . authenticationTokenID ) ,
. login_successful ( ) ,
projectViewModel . analytics . loginRegistration
checkIfUserAgreedBefore ( result ) ,
. login_successful ( ) ,
}
checkIfUserAgreedBefore ( result ) ,
}
}
else
}
{
else
/ / Navigator . of ( context ) . pop ( ) ,
{
GifLoaderDialogUtils . hideDialog ( context ) ,
/ / Navigator . of ( context ) . pop ( ) ,
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
GifLoaderDialogUtils . hideDialog ( context ) ,
AppToast . showErrorToast ( message: result ) ;
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
startSMSService ( tempType ) ;
AppToast . showErrorToast ( message: result ) ;
} ) ,
startSMSService ( tempType ) ;
} ) ,
projectViewModel . analytics . loginRegistration
. login_fail ( error: result ) ,
projectViewModel . analytics . loginRegistration
projectViewModel . analytics . errorTracking
. login_fail ( error: result ) ,
. log ( ' otp_verification_at_confirm_login ' , error: result )
projectViewModel . analytics . errorTracking
}
. log ( ' otp_verification_at_confirm_login ' , error: result )
} )
}
} )
. catchError ( ( err ) {
. catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
Future . delayed ( Duration ( seconds: 1 ) , ( ) {
@ -888,28 +906,29 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getToDoCount ( ) ;
getToDoCount ( ) ;
appointmentRateViewModel
appointmentRateViewModel
. getIsLastAppointmentRatedList ( projectViewModel . isArabic ? 1 : 2 )
. getIsLastAppointmentRatedList ( projectViewModel . isArabic ? 1 : 2 )
. then ( ( value ) = > {
. then ( ( value ) = >
GifLoaderDialogUtils . hideDialog ( AppGlobal . context ) ,
{
if ( appointmentRateViewModel . isHaveAppointmentNotRate )
GifLoaderDialogUtils . hideDialog ( AppGlobal . context ) ,
{
if ( appointmentRateViewModel . isHaveAppointmentNotRate )
Navigator . pushAndRemoveUntil (
{
context ,
Navigator . pushAndRemoveUntil (
FadePage (
context ,
page: RateAppointmentDoctor ( ) ,
FadePage (
) ,
page: RateAppointmentDoctor ( ) ,
( r ) = > false )
) ,
}
( r ) = > false )
else
}
{
else
Navigator . pushAndRemoveUntil (
{
context ,
Navigator . pushAndRemoveUntil (
FadePage (
context ,
page: LandingPage ( ) ,
FadePage (
) ,
page: LandingPage ( ) ,
( r ) = > false )
) ,
} ,
( r ) = > false )
insertIMEI ( )
} ,
} )
insertIMEI ( )
} )
. catchError ( ( err ) {
. catchError ( ( err ) {
print ( err ) ;
print ( err ) ;
} ) ;
} ) ;
@ -931,28 +950,27 @@ class _ConfirmLogin extends State<ConfirmLogin> {
} ) ;
} ) ;
}
}
Widget _loginOptionButton (
Widget _loginOptionButton ( String _title , String _icon , int _flag , int ? _loginIndex ) {
String _title , String _icon , int _flag , int ? _loginIndex ) {
bool isDisable =
bool isDisable =
( _flag = = 3 & & ! checkIfBiometricAvailable ( BiometricType . face ) | |
( _flag = = 3 & & ! checkIfBiometricAvailable ( BiometricType . face ) | |
_flag = = 2 & &
! checkIfBiometricAvailable ( BiometricType . fingerprint ) & &
_flag = = 2 & &
_flag = = 2 & &
! checkIfBiometricAvailable ( BiometricType . fingerprint ) & &
! checkIfBiometricAvailable ( BiometricType . strong ) ) ;
_flag = = 2 & &
! checkIfBiometricAvailable ( BiometricType . strong ) ) ;
return InkWell (
return InkWell (
onTap: isDisable
onTap: isDisable
? null
? null
: ( ) {
: ( ) {
if ( _flag = = 0 ) {
if ( _flag = = 0 ) {
setState ( ( ) {
setState ( ( ) {
isMoreOption = true ;
isMoreOption = true ;
} ) ;
} ) ;
} else {
} else {
authenticateUser ( _flag , isActive: _loginIndex ) ;
authenticateUser ( _flag , isActive: _loginIndex ) ;
projectViewModel . analytics . loginRegistration . verify_otp_method (
projectViewModel . analytics . loginRegistration . verify_otp_method (
forRegistration: widget . fromRegistration ) ;
forRegistration: widget . fromRegistration ) ;
}
}
} ,
} ,
child: Container (
child: Container (
padding: EdgeInsets . only ( left: 20 , right: 20 , bottom: 15 , top: 28 ) ,
padding: EdgeInsets . only ( left: 20 , right: 20 , bottom: 15 , top: 28 ) ,
decoration: BoxDecoration (
decoration: BoxDecoration (
@ -974,7 +992,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
color: isDisable ? Color ( 0xff2B353E ) . withOpacity ( 0.7 ) : null ,
color: isDisable ? Color ( 0xff2B353E ) . withOpacity ( 0.7 ) : null ,
) ,
) ,
Text (
Text (
TranslationBase . of ( context ) . verifyThrough + " " + _title ,
TranslationBase
. of ( context )
. verifyThrough + " " + _title ,
style: TextStyle (
style: TextStyle (
fontSize: 16 ,
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
fontWeight: FontWeight . w600 ,
@ -994,23 +1014,31 @@ class _ConfirmLogin extends State<ConfirmLogin> {
Widget getButton ( int flag ) {
Widget getButton ( int flag ) {
switch ( flag ) {
switch ( flag ) {
case 4 :
case 4 :
return _loginOptionButton ( TranslationBase . of ( context ) . verifyWhatsApp ,
return _loginOptionButton ( TranslationBase
. of ( context )
. verifyWhatsApp ,
' assets/images/new/verify_whatsapp.svg ' , flag , null ) ;
' assets/images/new/verify_whatsapp.svg ' , flag , null ) ;
break ;
break ;
case 1 :
case 1 :
return _loginOptionButton ( TranslationBase . of ( context ) . verifySMS ,
return _loginOptionButton ( TranslationBase
. of ( context )
. verifySMS ,
' assets/images/new/verify_sms.svg ' , flag , null ) ;
' assets/images/new/verify_sms.svg ' , flag , null ) ;
break ;
break ;
case 2 :
case 2 :
return _loginOptionButton (
return _loginOptionButton (
TranslationBase . of ( context ) . verifyFingerprint ,
TranslationBase
. of ( context )
. verifyFingerprint ,
' assets/images/new/verify_thumb.svg ' ,
' assets/images/new/verify_thumb.svg ' ,
flag ,
flag ,
BiometricType . fingerprint . index ) ;
BiometricType . fingerprint . index ) ;
break ;
break ;
case 3 :
case 3 :
return _loginOptionButton (
return _loginOptionButton (
TranslationBase . of ( context ) . verifyFaceID ,
TranslationBase
. of ( context )
. verifyFaceID ,
' assets/images/new/verify_face.svg ' ,
' assets/images/new/verify_face.svg ' ,
flag ,
flag ,
BiometricType . face . index ) ;
BiometricType . face . index ) ;
@ -1018,7 +1046,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
default :
default :
return InkWell (
return InkWell (
onTap: ( ) = > {
onTap: ( ) = >
{
setState ( ( ) {
setState ( ( ) {
isMoreOption = true ;
isMoreOption = true ;
} )
} )
@ -1041,12 +1070,14 @@ class _ConfirmLogin extends State<ConfirmLogin> {
) ,
) ,
projectViewModel . isArabic
projectViewModel . isArabic
? SizedBox (
? SizedBox (
height: 15 ,
height: 15 ,
)
)
: SizedBox (
: SizedBox (
height: 20 ,
height: 20 ,
) ,
) ,
Texts ( TranslationBase . of ( context ) . moreVerification ,
Texts ( TranslationBase
. of ( context )
. moreVerification ,
fontSize: SizeConfig . textMultiplier ! * 1.8 ,
fontSize: SizeConfig . textMultiplier ! * 1.8 ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
color: Colors . black )
color: Colors . black )
@ -1061,19 +1092,29 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getType ( type , context ) {
getType ( type , context ) {
switch ( type ) {
switch ( type ) {
case 1 :
case 1 :
return TranslationBase . of ( context ) . verifySMS ;
return TranslationBase
. of ( context )
. verifySMS ;
break ;
break ;
case 2 :
case 2 :
return TranslationBase . of ( context ) . verifyFingerprint ;
return TranslationBase
. of ( context )
. verifyFingerprint ;
break ;
break ;
case 3 :
case 3 :
return TranslationBase . of ( context ) . verifyFaceID ;
return TranslationBase
. of ( context )
. verifyFaceID ;
break ;
break ;
case 4 :
case 4 :
return TranslationBase . of ( context ) . verifyWhatsApp ;
return TranslationBase
. of ( context )
. verifyWhatsApp ;
break ;
break ;
default :
default :
return TranslationBase . of ( context ) . verifySMS ;
return TranslationBase
. of ( context )
. verifySMS ;
break ;
break ;
}
}
}
}