@ -18,10 +18,7 @@ import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dar
import ' package:hmg_patient_app_new/widgets/buttons/custom_button.dart ' ;
import ' package:hmg_patient_app_new/widgets/buttons/custom_button.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:provider/provider.dart ' ;
class SavedLogin extends StatefulWidget {
class SavedLogin extends StatefulWidget {
const SavedLogin ( { Key ? key } ) : super ( key: key ) ;
const SavedLogin ( { Key ? key } ) : super ( key: key ) ;
@ override
@ override
@ -29,15 +26,17 @@ class SavedLogin extends StatefulWidget {
}
}
class _SavedLogin extends State < SavedLogin > {
class _SavedLogin extends State < SavedLogin > {
LoginTypeEnum loginType = LoginTypeEnum . sms ;
LoginTypeEnum loginType = LoginTypeEnum . sms ;
late AuthenticationViewModel authVm ;
late AuthenticationViewModel authVm ;
late AppState appState ;
late AppState appState ;
@ override
@ override
void initState ( ) {
void initState ( ) {
authVm = context . read < AuthenticationViewModel > ( ) ;
authVm = context . read < AuthenticationViewModel > ( ) ;
appState = getIt . get < AppState > ( ) ;
appState = getIt . get < AppState > ( ) ;
authVm . phoneNumberController . text = appState . getSelectDeviceByImeiRespModelElement ! . mobile ! ;
authVm . phoneNumberController . text = appState . getSelectDeviceByImeiRespModelElement ! . mobile ! . startsWith ( " 0 " )
? appState . getSelectDeviceByImeiRespModelElement ! . mobile ! . replaceFirst ( " 0 " , " " )
: appState . getSelectDeviceByImeiRespModelElement ! . mobile ! ;
authVm . nationalIdController . text = appState . getSelectDeviceByImeiRespModelElement ! . identificationNo ! ;
authVm . nationalIdController . text = appState . getSelectDeviceByImeiRespModelElement ! . identificationNo ! ;
super . initState ( ) ;
super . initState ( ) ;
@ -45,11 +44,12 @@ class _SavedLogin extends State<SavedLogin> {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Scaffold (
return Scaffold (
backgroundColor: AppColors . scaffoldBgColor ,
appBar: CustomAppBar (
appBar: CustomAppBar (
onBackPressed: ( ) { } ,
onBackPressed: ( ) {
Navigator . of ( context ) . pop ( ) ;
} ,
onLanguageChanged: ( lang ) { } ,
onLanguageChanged: ( lang ) { } ,
) ,
) ,
body: SafeArea (
body: SafeArea (
@ -78,12 +78,16 @@ class _SavedLogin extends State<SavedLogin> {
children: [
children: [
/ / Last login info
/ / Last login info
( " ${ LocaleKeys . lastloginBy . tr ( ) } ${ LoginTypeExtension . fromValue ( appState . getSelectDeviceByImeiRespModelElement ! . logInType ! ) ! . displayName } "
( " ${ LocaleKeys . lastloginBy . tr ( ) } ${ LoginTypeExtension . fromValue ( appState . getSelectDeviceByImeiRespModelElement ! . logInType ! ) ! . displayName } " )
) . toText14 ( isBold: true , color: AppColors . greyTextColor ) ,
. toText14 ( isBold: true , color: AppColors . greyTextColor ) ,
( appState . getSelectDeviceByImeiRespModelElement ! . createdOn ! = null ? DateUtil . getFormattedDate ( DateUtil . convertStringToDate ( appState . getSelectDeviceByImeiRespModelElement ! . createdOn ! ) , " d MMMM, y at HH:mm " ) : ' -- ' )
( appState . getSelectDeviceByImeiRespModelElement ! . createdOn ! = null
? DateUtil . getFormattedDate ( DateUtil . convertStringToDate ( appState . getSelectDeviceByImeiRespModelElement ! . createdOn ! ) , " d MMMM, y at HH:mm " )
: ' -- ' )
. toText16 ( isBold: true , color: AppColors . textColor ) ,
. toText16 ( isBold: true , color: AppColors . textColor ) ,
Container ( margin: EdgeInsets . all ( 16. h ) , child: Utils . buildSvgWithAssets ( icon: getTypeIcons ( loginType . toInt ) , height: 54 , width: 54 , iconColor: loginType . toInt = = 4 ? null : AppColors . primaryRedColor ) ) ,
Container (
margin: EdgeInsets . all ( 16. h ) ,
child: Utils . buildSvgWithAssets ( icon: getTypeIcons ( loginType . toInt ) , height: 54 , width: 54 , iconColor: loginType . toInt = = 4 ? null : AppColors . primaryRedColor ) ) ,
/ / Face ID login button
/ / Face ID login button
SizedBox (
SizedBox (
height: 45 ,
height: 45 ,
@ -92,8 +96,7 @@ class _SavedLogin extends State<SavedLogin> {
onPressed: ( ) {
onPressed: ( ) {
if ( loginType = = LoginTypeEnum . fingerprint | | loginType = = LoginTypeEnum . face ) {
if ( loginType = = LoginTypeEnum . fingerprint | | loginType = = LoginTypeEnum . face ) {
authVm . loginWithFingerPrintFace ( loginType . toInt ) ;
authVm . loginWithFingerPrintFace ( loginType . toInt ) ;
}
} else {
else {
/ / int ? val = loginType . toInt ;
/ / int ? val = loginType . toInt ;
authVm . checkUserAuthentication ( otpTypeEnum: loginType = = LoginTypeEnum . sms ? OTPTypeEnum . sms : OTPTypeEnum . whatsapp ) ;
authVm . checkUserAuthentication ( otpTypeEnum: loginType = = LoginTypeEnum . sms ? OTPTypeEnum . sms : OTPTypeEnum . whatsapp ) ;
}
}
@ -217,7 +220,6 @@ class _SavedLogin extends State<SavedLogin> {
loginType = LoginTypeEnum . whatsapp ;
loginType = LoginTypeEnum . whatsapp ;
int ? val = loginType . toInt ;
int ? val = loginType . toInt ;
authVm . checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . whatsapp ) ;
authVm . checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . whatsapp ) ;
}
}
} ,
} ,
backgroundColor: AppColors . whiteColor ,
backgroundColor: AppColors . whiteColor ,