|
|
|
@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
|
|
|
|
@ -72,173 +73,165 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AppScaffold(
|
|
|
|
return AppScaffold(
|
|
|
|
appBarTitle: TranslationBase.of(context).confirm,
|
|
|
|
appBarTitle: TranslationBase.of(context).confirm,
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowDecPage: false,
|
|
|
|
isShowDecPage: false,
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.all(20),
|
|
|
|
padding: EdgeInsets.all(20),
|
|
|
|
height: SizeConfig.realScreenHeight * .9,
|
|
|
|
height: SizeConfig.realScreenHeight * .9,
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
flex: 3,
|
|
|
|
flex: 3,
|
|
|
|
child: user != null && isMoreOption == false
|
|
|
|
child: user != null && isMoreOption == false
|
|
|
|
? Column(
|
|
|
|
? Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Image.asset(
|
|
|
|
Image.asset(
|
|
|
|
'assets/images/DQ/dq_logo_icon.png',
|
|
|
|
'assets/images/DQ/dq_logo_icon.png',
|
|
|
|
height: 90,
|
|
|
|
height: 90,
|
|
|
|
width: 90,
|
|
|
|
width: 90,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).welcomeBack +
|
|
|
|
TranslationBase.of(context).welcomeBack +
|
|
|
|
' ' +
|
|
|
|
' ' +
|
|
|
|
user.name,
|
|
|
|
user.name,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).accountInfo,
|
|
|
|
TranslationBase.of(context).accountInfo,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Card(
|
|
|
|
Card(
|
|
|
|
color: Colors.grey[300],
|
|
|
|
color: Colors.grey[300],
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
title: Text(
|
|
|
|
title: Text(
|
|
|
|
TranslationBase.of(context).lastLoginAt,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
.lastLoginAt,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
subtitle: Text(
|
|
|
|
),
|
|
|
|
user.editedOn != null
|
|
|
|
subtitle: Text(
|
|
|
|
? formatDate(
|
|
|
|
user.editedOn != null
|
|
|
|
DateUtil.convertStringToDate(
|
|
|
|
? formatDate(DateUtil
|
|
|
|
user.editedOn))
|
|
|
|
.convertStringToDate(
|
|
|
|
: '--',
|
|
|
|
user.editedOn))
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
: '--',
|
|
|
|
)),
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
Expanded(
|
|
|
|
)),
|
|
|
|
child: ListTile(
|
|
|
|
Expanded(
|
|
|
|
title: Text(
|
|
|
|
child: ListTile(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
title: Text(
|
|
|
|
.lastLoginWith,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
.lastLoginWith,
|
|
|
|
subtitle: Text(
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
getType(user.logInType, context),
|
|
|
|
subtitle: Text(
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
getType(
|
|
|
|
))
|
|
|
|
user.logInType, context),
|
|
|
|
],
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
))
|
|
|
|
: Column(
|
|
|
|
],
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
)
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
mainAxisAlignment:
|
|
|
|
Image.asset(
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
'assets/images/DQ/dq_logo_icon.png',
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
height: 90,
|
|
|
|
children: <Widget>[
|
|
|
|
width: 90,
|
|
|
|
Image.asset(
|
|
|
|
),
|
|
|
|
'assets/images/DQ/dq_logo_icon.png',
|
|
|
|
this.onlySMSBox == false
|
|
|
|
height: 90,
|
|
|
|
? AppText(
|
|
|
|
width: 90,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
this.onlySMSBox == false
|
|
|
|
])),
|
|
|
|
? AppText(
|
|
|
|
user != null && isMoreOption == false
|
|
|
|
TranslationBase.of(context)
|
|
|
|
? Expanded(
|
|
|
|
.verifyLoginWith,
|
|
|
|
flex: 2,
|
|
|
|
fontSize:
|
|
|
|
child: Column(
|
|
|
|
SizeConfig.textMultiplier * 3.5,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
)
|
|
|
|
children: <Widget>[
|
|
|
|
: AppText(
|
|
|
|
Row(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
.verifyFingerprint2,
|
|
|
|
|
|
|
|
fontSize:
|
|
|
|
|
|
|
|
SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
])),
|
|
|
|
|
|
|
|
user != null && isMoreOption == false
|
|
|
|
|
|
|
|
? Expanded(
|
|
|
|
|
|
|
|
flex: 2,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: InkWell(
|
|
|
|
|
|
|
|
onTap: () => {
|
|
|
|
|
|
|
|
authenticateUser(
|
|
|
|
|
|
|
|
3,
|
|
|
|
|
|
|
|
BiometricType
|
|
|
|
|
|
|
|
.face.index)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
getButton(user.logInType))),
|
|
|
|
|
|
|
|
Expanded(child: getButton(5))
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
]))
|
|
|
|
|
|
|
|
: Expanded(
|
|
|
|
|
|
|
|
flex: 4,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
onlySMSBox == false
|
|
|
|
Expanded(
|
|
|
|
? Row(
|
|
|
|
child: InkWell(
|
|
|
|
mainAxisAlignment:
|
|
|
|
onTap: () => {
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
authenticateUser(
|
|
|
|
children: <Widget>[
|
|
|
|
3, BiometricType.face.index)
|
|
|
|
Expanded(child: getButton(3)),
|
|
|
|
},
|
|
|
|
Expanded(child: getButton(2))
|
|
|
|
child: getButton(user.logInType))),
|
|
|
|
],
|
|
|
|
Expanded(child: getButton(5))
|
|
|
|
)
|
|
|
|
])
|
|
|
|
: SizedBox(),
|
|
|
|
]))
|
|
|
|
Row(
|
|
|
|
: Expanded(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
flex: 4,
|
|
|
|
children: <Widget>[
|
|
|
|
child: Column(
|
|
|
|
Expanded(child: getButton(1)),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
Expanded(child: getButton(4))
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
user != null
|
|
|
|
onlySMSBox == false
|
|
|
|
? Row(
|
|
|
|
? Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(child: getButton(3)),
|
|
|
|
child: DefaultButton(
|
|
|
|
Expanded(child: getButton(2))
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.useAnotherAccount,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
|
|
|
LOGIN_TYPE,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
: SizedBox(),
|
|
|
|
],
|
|
|
|
Row(
|
|
|
|
))
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Expanded(child: getButton(1)),
|
|
|
|
|
|
|
|
Expanded(child: getButton(4))
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
flex: 1,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
user != null
|
|
|
|
|
|
|
|
? Row(
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
|
|
|
TranslationBase.of(context).useAnotherAccount,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
|
|
|
LOGIN_TYPE,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: SizedBox(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
))));
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _getAvailableBiometrics() async {
|
|
|
|
Future<void> _getAvailableBiometrics() async {
|
|
|
|
@ -300,6 +293,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
showLoader(true);
|
|
|
|
showLoader(true);
|
|
|
|
var req = getCommonRequest();
|
|
|
|
var req = getCommonRequest();
|
|
|
|
var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
|
|
|
|
var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
|
|
|
|
authService
|
|
|
|
authService
|
|
|
|
@ -321,18 +315,23 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catchError((err) {
|
|
|
|
.catchError((err) {
|
|
|
|
print(err);
|
|
|
|
print(err);
|
|
|
|
}).showProgressBar(
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sendActivationCode(type) async {
|
|
|
|
sendActivationCode(type) async {
|
|
|
|
var request = this.getCommonRequest();
|
|
|
|
var request = this.getCommonRequest();
|
|
|
|
// loading(true);
|
|
|
|
// loading(true);
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
await this.authService.sendActivationCode(request).then((result) => {
|
|
|
|
await this.authService.sendActivationCode(request).then((result) {
|
|
|
|
if (result != null && result['isSMSSent'] == true)
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
{this.startSMSService(type), print(result)}
|
|
|
|
if (result != null && result['isSMSSent'] == true) {
|
|
|
|
});
|
|
|
|
this.startSMSService(type);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catchError((r) {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// SMSOTP.showLoadingDialog(context, false),
|
|
|
|
// SMSOTP.showLoadingDialog(context, false),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -479,11 +478,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkActivationCode({value}) async {
|
|
|
|
checkActivationCode({value}) async {
|
|
|
|
SMSOTP.showLoadingDialog(context, true);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
var request = this.getCommonRequest().toJson();
|
|
|
|
var request = this.getCommonRequest().toJson();
|
|
|
|
|
|
|
|
|
|
|
|
this
|
|
|
|
authService
|
|
|
|
.authService
|
|
|
|
|
|
|
|
.checkActivationCode(request, value)
|
|
|
|
.checkActivationCode(request, value)
|
|
|
|
.then((result) => {
|
|
|
|
.then((result) => {
|
|
|
|
if (result is Map)
|
|
|
|
if (result is Map)
|
|
|
|
@ -498,25 +496,20 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.userData = result
|
|
|
|
userData = result.list,
|
|
|
|
.list, //AuthenticatedUser.fromJson(result['List'][0]),
|
|
|
|
//AuthenticatedUser.fromJson(result['List'][0]),
|
|
|
|
this.sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
this.loginTokenID = result.logInTokenID,
|
|
|
|
loginTokenID = result.logInTokenID,
|
|
|
|
this
|
|
|
|
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
|
|
.sharedPref
|
|
|
|
sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
|
|
.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
|
|
checkIfUserAgreedBefore(result),
|
|
|
|
this
|
|
|
|
|
|
|
|
.sharedPref
|
|
|
|
|
|
|
|
.setString(TOKEN, result.authenticationTokenID),
|
|
|
|
|
|
|
|
this.checkIfUserAgreedBefore(result),
|
|
|
|
|
|
|
|
// Navigator.of(context).pop(),
|
|
|
|
|
|
|
|
SMSOTP.showLoadingDialog(context, false),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Navigator.of(context).pop(),
|
|
|
|
// Navigator.of(context).pop(),
|
|
|
|
SMSOTP.showLoadingDialog(context, false),
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
|
AppToast.showErrorToast(message: result);
|
|
|
|
AppToast.showErrorToast(message: result);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
@ -524,8 +517,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catchError((err) {
|
|
|
|
.catchError((err) {
|
|
|
|
print(err);
|
|
|
|
print(err);
|
|
|
|
}).showProgressBar(
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkIfUserAgreedBefore(CheckActivationCode result) {
|
|
|
|
checkIfUserAgreedBefore(CheckActivationCode result) {
|
|
|
|
|