|
|
|
|
@ -4,8 +4,8 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/auth_method_types.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/doctor_profile_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/auth/sms-popup.dart';
|
|
|
|
|
@ -19,7 +19,6 @@ import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../config/size_config.dart';
|
|
|
|
|
import '../../core/viewModel/doctor_profile_view_model.dart';
|
|
|
|
|
import '../../landing_page.dart';
|
|
|
|
|
import '../../routes.dart';
|
|
|
|
|
import '../../util/dr_app_shared_pref.dart';
|
|
|
|
|
@ -46,28 +45,25 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
DoctorProfileViewModel doctorProfileViewModel;
|
|
|
|
|
AuthMethodTypes fingerPrintBefore;
|
|
|
|
|
AuthMethodTypes selectedOption;
|
|
|
|
|
AuthenticationViewModel model;
|
|
|
|
|
AuthenticationViewModel authenticationViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
doctorProfileViewModel = Provider.of<DoctorProfileViewModel>(context);
|
|
|
|
|
projectsProvider = Provider.of<ProjectViewModel>(context);
|
|
|
|
|
return BaseView<AuthenticationViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
this.model = model;
|
|
|
|
|
await model.getInitUserInfo();
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
|
|
|
|
|
height: SizeConfig.realScreenHeight * .95,
|
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
|
child: Column(
|
|
|
|
|
authenticationViewModel = Provider.of<AuthenticationViewModel>(context);
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
// baseViewModel: model,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
|
|
|
|
|
height: SizeConfig.realScreenHeight * .95,
|
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -77,284 +73,280 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
),
|
|
|
|
|
model.user != null && isMoreOption == false
|
|
|
|
|
authenticationViewModel.user != null && isMoreOption == false
|
|
|
|
|
? Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).welcomeBack),
|
|
|
|
|
AppText(
|
|
|
|
|
Helpers.capitalize(authenticationViewModel.user.doctorName),
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).accountInfo,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Card(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.lastLoginAt,
|
|
|
|
|
overflow:
|
|
|
|
|
TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w800,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
authenticationViewModel.getType(
|
|
|
|
|
authenticationViewModel.user
|
|
|
|
|
.logInTypeID,
|
|
|
|
|
context),
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
))),
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 2,
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: AppText(
|
|
|
|
|
authenticationViewModel.user.editedOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getDayMonthYearDateFormatted(
|
|
|
|
|
DateUtils.convertStringToDate(
|
|
|
|
|
authenticationViewModel.user
|
|
|
|
|
.editedOn))
|
|
|
|
|
: authenticationViewModel.user.createdOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getDayMonthYearDateFormatted(
|
|
|
|
|
DateUtils.convertStringToDate(authenticationViewModel.user
|
|
|
|
|
.createdOn))
|
|
|
|
|
: '--',
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.right,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
authenticationViewModel.user.editedOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getHour(
|
|
|
|
|
DateUtils.convertStringToDate(
|
|
|
|
|
authenticationViewModel.user
|
|
|
|
|
.editedOn))
|
|
|
|
|
: authenticationViewModel.user.createdOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getHour(
|
|
|
|
|
DateUtils.convertStringToDate(authenticationViewModel.user
|
|
|
|
|
.createdOn))
|
|
|
|
|
: '--',
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.right,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
this.onlySMSBox == false
|
|
|
|
|
? AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.verifyLoginWith,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier * 3.5,
|
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
)
|
|
|
|
|
: AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.verifyFingerprint2,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
authenticationViewModel.user != null && isMoreOption == false
|
|
|
|
|
? Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () =>
|
|
|
|
|
{
|
|
|
|
|
// TODO check this logic it seem it will create bug to us
|
|
|
|
|
authenticateUser(
|
|
|
|
|
AuthMethodTypes
|
|
|
|
|
.Fingerprint, true)
|
|
|
|
|
},
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType: SelectedAuthMethodTypesService
|
|
|
|
|
.getMethodsTypeService(
|
|
|
|
|
authenticationViewModel.user
|
|
|
|
|
.logInTypeID),
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.MoreOptions,
|
|
|
|
|
onShowMore: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isMoreOption = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
]),
|
|
|
|
|
])
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
onlySMSBox == false
|
|
|
|
|
? Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).welcomeBack),
|
|
|
|
|
AppText(
|
|
|
|
|
Helpers.capitalize(model.user.doctorName),
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).accountInfo,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Card(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.lastLoginAt,
|
|
|
|
|
overflow:
|
|
|
|
|
TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w800,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
model.getType(
|
|
|
|
|
model.user
|
|
|
|
|
.logInTypeID,
|
|
|
|
|
context),
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
))),
|
|
|
|
|
Flexible(
|
|
|
|
|
flex: 2,
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: AppText(
|
|
|
|
|
model.user.editedOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getDayMonthYearDateFormatted(
|
|
|
|
|
DateUtils.convertStringToDate(
|
|
|
|
|
model.user
|
|
|
|
|
.editedOn))
|
|
|
|
|
: model.user.createdOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getDayMonthYearDateFormatted(
|
|
|
|
|
DateUtils.convertStringToDate(model
|
|
|
|
|
.user
|
|
|
|
|
.createdOn))
|
|
|
|
|
: '--',
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.right,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w800,
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
model.user.editedOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getHour(
|
|
|
|
|
DateUtils.convertStringToDate(
|
|
|
|
|
model.user
|
|
|
|
|
.editedOn))
|
|
|
|
|
: model.user.createdOn !=
|
|
|
|
|
null
|
|
|
|
|
? DateUtils.getHour(
|
|
|
|
|
DateUtils.convertStringToDate(model
|
|
|
|
|
.user
|
|
|
|
|
.createdOn))
|
|
|
|
|
: '--',
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.right,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.Fingerprint,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
)),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.FaceID,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
this.onlySMSBox == false
|
|
|
|
|
? AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.verifyLoginWith,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier * 3.5,
|
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
)
|
|
|
|
|
: AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.verifyFingerprint2,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
model.user != null && isMoreOption == false
|
|
|
|
|
? Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () =>
|
|
|
|
|
{
|
|
|
|
|
// TODO check this logic it seem it will create bug to us
|
|
|
|
|
authenticateUser(
|
|
|
|
|
AuthMethodTypes
|
|
|
|
|
.Fingerprint, true)
|
|
|
|
|
},
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType: SelectedAuthMethodTypesService
|
|
|
|
|
.getMethodsTypeService(
|
|
|
|
|
model.user
|
|
|
|
|
.logInTypeID),
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.MoreOptions,
|
|
|
|
|
onShowMore: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isMoreOption = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
]),
|
|
|
|
|
])
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
onlySMSBox == false
|
|
|
|
|
? Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.Fingerprint,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
)),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.FaceID,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(AuthMethodTypes
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType,
|
|
|
|
|
isActive),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType: AuthMethodTypes
|
|
|
|
|
.SMS,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(
|
|
|
|
|
AuthMethodTypes authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType, isActive),
|
|
|
|
|
)),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
model: model,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.WhatsApp,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(
|
|
|
|
|
AuthMethodTypes authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType, isActive),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType: AuthMethodTypes
|
|
|
|
|
.SMS,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(
|
|
|
|
|
AuthMethodTypes authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType, isActive),
|
|
|
|
|
)),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VerificationMethodsList(
|
|
|
|
|
authenticationViewModel:authenticationViewModel,
|
|
|
|
|
authMethodType:
|
|
|
|
|
AuthMethodTypes.WhatsApp,
|
|
|
|
|
authenticateUser:
|
|
|
|
|
(
|
|
|
|
|
AuthMethodTypes authMethodType,
|
|
|
|
|
isActive) =>
|
|
|
|
|
authenticateUser(
|
|
|
|
|
authMethodType, isActive),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.user == null ? SizedBox(height: 0,) : Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: HexColor('#707070'),
|
|
|
|
|
width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: 90,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.useAnotherAccount,
|
|
|
|
|
color: Colors.red[700],
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pushNamed(LOGIN);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 25,)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: authenticationViewModel.user == null ? SizedBox(height: 0,) : Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: HexColor('#707070'),
|
|
|
|
|
width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: 90,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.useAnotherAccount,
|
|
|
|
|
color: Colors.red[700],
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pushNamed(LOGIN);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 25,)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -365,12 +357,12 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await model.sendActivationCodeForDoctorApp(authMethodType:authMethodType, password: widget.password );
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
await authenticationViewModel.sendActivationCodeForDoctorApp(authMethodType:authMethodType, password: widget.password );
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
} else {
|
|
|
|
|
model.setDataAfterSendActivationSuccsess(model.activationCodeForDoctorAppRes);
|
|
|
|
|
authenticationViewModel.setDataAfterSendActivationSuccsess(authenticationViewModel.activationCodeForDoctorAppRes);
|
|
|
|
|
sharedPref.setString(PASSWORD, widget.password);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
this.startSMSService(authMethodType);
|
|
|
|
|
@ -385,14 +377,14 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
|
|
|
|
|
sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model
|
|
|
|
|
await authenticationViewModel
|
|
|
|
|
.sendActivationCodeVerificationScreen(authMethodType);
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
model.setDataAfterSendActivationSuccsess(model.activationCodeVerificationScreenRes);
|
|
|
|
|
authenticationViewModel.setDataAfterSendActivationSuccsess(authenticationViewModel.activationCodeVerificationScreenRes);
|
|
|
|
|
if (authMethodType == AuthMethodTypes.SMS ||
|
|
|
|
|
authMethodType == AuthMethodTypes.WhatsApp) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
@ -432,7 +424,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendActivationCode(AuthMethodTypes authMethodType) async {
|
|
|
|
|
if (model.user != null) {
|
|
|
|
|
if (authenticationViewModel.user != null) {
|
|
|
|
|
sendActivationCodeVerificationScreen(authMethodType);
|
|
|
|
|
} else {
|
|
|
|
|
sendActivationCodeByOtpNotificationType(authMethodType);
|
|
|
|
|
@ -444,7 +436,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
new SMSOTP(
|
|
|
|
|
context,
|
|
|
|
|
type,
|
|
|
|
|
model.loggedUser != null ? model.loggedUser.mobileNumber : model.user.mobile,
|
|
|
|
|
authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser.mobileNumber : authenticationViewModel.user.mobile,
|
|
|
|
|
(value) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
@ -465,14 +457,14 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes,
|
|
|
|
|
isActive) async {
|
|
|
|
|
if (isActive) {
|
|
|
|
|
await model.showIOSAuthMessages();
|
|
|
|
|
await authenticationViewModel.showIOSAuthMessages();
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
if (model.user != null &&
|
|
|
|
|
if (authenticationViewModel.user != null &&
|
|
|
|
|
(SelectedAuthMethodTypesService.getMethodsTypeService(
|
|
|
|
|
model.user.logInTypeID) ==
|
|
|
|
|
authenticationViewModel.user.logInTypeID) ==
|
|
|
|
|
AuthMethodTypes.Fingerprint ||
|
|
|
|
|
SelectedAuthMethodTypesService.getMethodsTypeService(
|
|
|
|
|
model.user.logInTypeID) == AuthMethodTypes.FaceID)) {
|
|
|
|
|
authenticationViewModel.user.logInTypeID) == AuthMethodTypes.FaceID)) {
|
|
|
|
|
this.sendActivationCode(authMethodTypes);
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -483,19 +475,19 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkActivationCode({value}) async {
|
|
|
|
|
await model.checkActivationCodeForDoctorApp(activationCode: value);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value);
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
await model.onCheckActivationCodeSuccess();
|
|
|
|
|
await authenticationViewModel.onCheckActivationCodeSuccess();
|
|
|
|
|
navigateToLandingPage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigateToLandingPage() {
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
if (authenticationViewModel.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
projectsProvider.isLogin = true;
|
|
|
|
|
|
|
|
|
|
|