|
|
|
|
@ -40,15 +40,14 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:local_auth/local_auth.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 {
|
|
|
|
|
final Function? changePageViewIndex;
|
|
|
|
|
final fromRegistration;
|
|
|
|
|
final bool isDubai;
|
|
|
|
|
|
|
|
|
|
const ConfirmLogin(
|
|
|
|
|
{Key? key,
|
|
|
|
|
const ConfirmLogin({Key? key,
|
|
|
|
|
this.changePageViewIndex,
|
|
|
|
|
this.fromRegistration = false,
|
|
|
|
|
this.isDubai = false})
|
|
|
|
|
@ -145,7 +144,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).welcomeBack,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.welcomeBack,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -163,7 +164,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).accountInfo,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.accountInfo,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -193,7 +196,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.lastLoginAt
|
|
|
|
|
.toCamelCase,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
@ -225,7 +229,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.lastLoginWith
|
|
|
|
|
.toCamelCase,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
@ -268,7 +273,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).pleaseVerify,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.pleaseVerify,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -306,7 +313,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
SizedBox(height: 23),
|
|
|
|
|
this.onlySMSBox == false
|
|
|
|
|
? Text(
|
|
|
|
|
TranslationBase.of(context).verifyLoginWith,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyLoginWith,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -315,7 +324,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
height: 25 / 16),
|
|
|
|
|
)
|
|
|
|
|
: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyFingerprint2,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
@ -326,7 +336,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 23),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).pleaseVerify,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.pleaseVerify,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -357,7 +369,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).useAnotherAccount,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.useAnotherAccount,
|
|
|
|
|
() {
|
|
|
|
|
Navigator.of(context).pushNamed(LOGIN_TYPE);
|
|
|
|
|
projectViewModel.analytics.loginRegistration
|
|
|
|
|
@ -450,7 +464,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
|
|
|
|
|
authService
|
|
|
|
|
.checkPatientAuthentication(request)
|
|
|
|
|
.then((value) => {
|
|
|
|
|
.then((value) =>
|
|
|
|
|
{
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
if (value['isSMSSent'])
|
|
|
|
|
{
|
|
|
|
|
@ -519,7 +534,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
(value) {
|
|
|
|
|
this.checkActivationCode(value: value);
|
|
|
|
|
},
|
|
|
|
|
() => {
|
|
|
|
|
() =>
|
|
|
|
|
{
|
|
|
|
|
Navigator.pop(context),
|
|
|
|
|
},
|
|
|
|
|
).displayDialog(context);
|
|
|
|
|
@ -699,7 +715,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
|
|
|
|
|
authService
|
|
|
|
|
.checkActivationCodeRegister(request, value)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
.then((result) =>
|
|
|
|
|
{
|
|
|
|
|
res = result,
|
|
|
|
|
if (result is Map)
|
|
|
|
|
{
|
|
|
|
|
@ -743,7 +760,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
} else {
|
|
|
|
|
authService
|
|
|
|
|
.checkActivationCode(request, value)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
.then((result) =>
|
|
|
|
|
{
|
|
|
|
|
res = result,
|
|
|
|
|
if (result is Map)
|
|
|
|
|
{
|
|
|
|
|
@ -888,7 +906,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
getToDoCount();
|
|
|
|
|
appointmentRateViewModel
|
|
|
|
|
.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2)
|
|
|
|
|
.then((value) => {
|
|
|
|
|
.then((value) =>
|
|
|
|
|
{
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
|
|
|
|
|
if (appointmentRateViewModel.isHaveAppointmentNotRate)
|
|
|
|
|
{
|
|
|
|
|
@ -931,8 +950,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _loginOptionButton(
|
|
|
|
|
String _title, String _icon, int _flag, int? _loginIndex) {
|
|
|
|
|
Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) {
|
|
|
|
|
bool isDisable =
|
|
|
|
|
(_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) ||
|
|
|
|
|
_flag == 2 &&
|
|
|
|
|
@ -974,7 +992,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : null,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).verifyThrough + " " + _title,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyThrough + " " + _title,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -994,23 +1014,31 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
Widget getButton(int flag) {
|
|
|
|
|
switch (flag) {
|
|
|
|
|
case 4:
|
|
|
|
|
return _loginOptionButton(TranslationBase.of(context).verifyWhatsApp,
|
|
|
|
|
return _loginOptionButton(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyWhatsApp,
|
|
|
|
|
'assets/images/new/verify_whatsapp.svg', flag, null);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
return _loginOptionButton(TranslationBase.of(context).verifySMS,
|
|
|
|
|
return _loginOptionButton(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifySMS,
|
|
|
|
|
'assets/images/new/verify_sms.svg', flag, null);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return _loginOptionButton(
|
|
|
|
|
TranslationBase.of(context).verifyFingerprint,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyFingerprint,
|
|
|
|
|
'assets/images/new/verify_thumb.svg',
|
|
|
|
|
flag,
|
|
|
|
|
BiometricType.fingerprint.index);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
return _loginOptionButton(
|
|
|
|
|
TranslationBase.of(context).verifyFaceID,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyFaceID,
|
|
|
|
|
'assets/images/new/verify_face.svg',
|
|
|
|
|
flag,
|
|
|
|
|
BiometricType.face.index);
|
|
|
|
|
@ -1018,7 +1046,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () => {
|
|
|
|
|
onTap: () =>
|
|
|
|
|
{
|
|
|
|
|
setState(() {
|
|
|
|
|
isMoreOption = true;
|
|
|
|
|
})
|
|
|
|
|
@ -1046,7 +1075,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Texts(TranslationBase.of(context).moreVerification,
|
|
|
|
|
Texts(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.moreVerification,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
color: Colors.black)
|
|
|
|
|
@ -1061,19 +1092,29 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
|
getType(type, context) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 1:
|
|
|
|
|
return TranslationBase.of(context).verifySMS;
|
|
|
|
|
return TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifySMS;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return TranslationBase.of(context).verifyFingerprint;
|
|
|
|
|
return TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyFingerprint;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
return TranslationBase.of(context).verifyFaceID;
|
|
|
|
|
return TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyFaceID;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
return TranslationBase.of(context).verifyWhatsApp;
|
|
|
|
|
return TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifyWhatsApp;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return TranslationBase.of(context).verifySMS;
|
|
|
|
|
return TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.verifySMS;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|