Merge branch 'fix_login' into 'diplomatic-quarter-live'

Fix login

See merge request Cloud_Solution/diplomatic-quarter!94
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 55e25fade8

@ -5,13 +5,13 @@ class AppointmentDetails {
int appointmentNo; int appointmentNo;
int clinicID; int clinicID;
int doctorID; int doctorID;
String startTime; dynamic startTime;
String endTime; dynamic endTime;
String appointmentDate; dynamic appointmentDate;
String clinicName; dynamic clinicName;
String doctorImageURL; dynamic doctorImageURL;
String doctorName; dynamic doctorName;
String projectName; dynamic projectName;
AppointmentDetails( AppointmentDetails(
{this.setupID, {this.setupID,

@ -52,6 +52,7 @@ class MyApp extends StatelessWidget {
TranslationBaseDelegate(), TranslationBaseDelegate(),
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
], ],
supportedLocales: [ supportedLocales: [
const Locale('ar', ''), // Arabic const Locale('ar', ''), // Arabic

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/family/my-family.dart';
@ -317,7 +318,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: ParkingPage(), page: FindUsPage(),
), ),
), ),
imageLocation: 'assets/images/new-design/find_us_icon.png', imageLocation: 'assets/images/new-design/find_us_icon.png',

@ -179,8 +179,7 @@ class _AddMember extends State<AddMember> {
request.regionID = 1; request.regionID = 1;
} }
loading(true); loading(true);
this familyFileProvider
.familyFileProvider
.insertNewMember(request) .insertNewMember(request)
.then((value) => sendActivationCode(value)); .then((value) => sendActivationCode(value));
} }
@ -189,8 +188,7 @@ class _AddMember extends State<AddMember> {
// var request = this.getCommonRequest(); // var request = this.getCommonRequest();
loading(true); loading(true);
patientShareRequestID = result['PatientShareRequestID']; patientShareRequestID = result['PatientShareRequestID'];
this familyFileProvider
.familyFileProvider
.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text) .sendActivationCode(mobileNo, countryCode, nationalIDorFile.text)
.then((result) => { .then((result) => {
if (result != null && result['isSMSSent'] == true) if (result != null && result['isSMSSent'] == true)
@ -203,11 +201,13 @@ class _AddMember extends State<AddMember> {
startSMSService(type, result) { startSMSService(type, result) {
loading(false); loading(false);
new SMSOTP( SMSOTP(
context, context,
type, type,
this.mobileNo, mobileNo,
(value) => {this.checkActivationCode(value, result)}, (value) {
this.checkActivationCode(value, result);
},
() => { () => {
print('Faild..'), print('Faild..'),
}, },
@ -215,8 +215,7 @@ class _AddMember extends State<AddMember> {
} }
checkActivationCode(value, result) { checkActivationCode(value, result) {
this familyFileProvider
.familyFileProvider
.checkActivationCode( .checkActivationCode(
result['LogInTokenID'], value, nationalIDorFile.text, mobileNo) result['LogInTokenID'], value, nationalIDorFile.text, mobileNo)
.then((result) => { .then((result) => {
@ -226,8 +225,7 @@ class _AddMember extends State<AddMember> {
} }
handleFamilyRequests(id, stauts) { handleFamilyRequests(id, stauts) {
this familyFileProvider
.familyFileProvider
.acceptAndRejectRecievedRequests(id, stauts) .acceptAndRejectRecievedRequests(id, stauts)
.then((result) => { .then((result) => {
sharedPref.remove(FAMILY_FILE), sharedPref.remove(FAMILY_FILE),

@ -19,7 +19,7 @@ class InsuranceCard extends StatefulWidget {
@override @override
_InsuranceCardState createState() => _InsuranceCardState(); _InsuranceCardState createState() => _InsuranceCardState();
} }
//TODO fix it
class _InsuranceCardState extends State<InsuranceCard> { class _InsuranceCardState extends State<InsuranceCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -29,6 +29,7 @@ class _InsuranceCardState extends State<InsuranceCard> {
AppScaffold( AppScaffold(
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
image: 'assets/images/medical/insurance_card_icon.png',
appBarTitle: TranslationBase.of(context).insuranceCards, appBarTitle: TranslationBase.of(context).insuranceCards,
body: Container( body: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(

@ -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) {

@ -11,7 +11,6 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; 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/gif_loader_dialog_utils.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/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
@ -19,10 +18,12 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart';
class Login extends StatefulWidget { class Login extends StatefulWidget {
@override @override
@ -60,72 +61,76 @@ class _Login extends State<Login> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).login, appBarTitle: TranslationBase.of(context).login,
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
height: SizeConfig.realScreenHeight * .9, height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth, width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[ child: Column(
Expanded( children: <Widget>[
flex: 2, Expanded(
child: AppText( flex: 2,
TranslationBase.of(context).enterNationalId, child: AppText(
fontSize: SizeConfig.textMultiplier * 3.5, TranslationBase.of(context).enterNationalId,
textAlign: TextAlign.start, fontSize: SizeConfig.textMultiplier * 3.5,
)), textAlign: TextAlign.start,
Expanded( )),
flex: 3, Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
MobileNo(
onNumberChange: (value) =>
{mobileNo = value, validateForm()},
onCountryChange: (value) => countryCode = value),
Container(
child: TextFields(
fontWeight: FontWeight.normal,
controller: nationalIDorFile,
onChanged: (value) => {validateForm()},
prefixIcon: Icon(
loginType == 1
? Icons.chrome_reader_mode
: Icons.receipt,
color: Color(0xFF40ACC9)),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: loginType == 1
? TranslationBase.of(context).nationalID
: TranslationBase.of(context).fileNo,
))
],
),
),
Expanded(
flex: 3, flex: 3,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Row( MobileNo(
children: <Widget>[ onNumberChange: (value) =>
Expanded( {mobileNo = value, validateForm()},
child: DefaultButton( onCountryChange: (value) => countryCode = value),
TranslationBase.of(context).login, Container(
() => {this.startLogin()}, child: TextFields(
color: isButtonDisabled == true fontWeight: FontWeight.normal,
? Colors.grey controller: nationalIDorFile,
: Colors.grey[900], onChanged: (value) => {validateForm()},
textColor: Colors.white, prefixIcon: Icon(
)) loginType == 1
], ? Icons.chrome_reader_mode
), : Icons.receipt,
color: Color(0xFF40ACC9)),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: loginType == 1
? TranslationBase.of(context).nationalID
: TranslationBase.of(context).fileNo,
))
], ],
)) ),
]), ),
))); Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).login,
() => {this.startLogin()},
color: isButtonDisabled == true
? Colors.grey
: Colors.grey[900],
textColor: Colors.white,
))
],
),
],
))
],
),
),
),
);
} }
startLogin() { startLogin() {
@ -136,8 +141,10 @@ class _Login extends State<Login> {
void validateForm() { void validateForm() {
//TODO fix login //TODO fix login
if (util.validateIDBox(nationalIDorFile.text, loginType) == true && if (util.validateIDBox(nationalIDorFile.text, loginType) ==
mobileNo.length >= 9 && true /*&&
mobileNo.length >= 9 */
&&
util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) {
setState(() { setState(() {
isButtonDisabled = false; isButtonDisabled = false;
@ -151,7 +158,6 @@ class _Login extends State<Login> {
checkUserAuthentication() { checkUserAuthentication() {
// showLoader(true); // showLoader(true);
GifLoaderDialogUtils.showMyDialog(context);
var request = CheckPatientAuthenticationReq(); var request = CheckPatientAuthenticationReq();
request.isRegister = false; request.isRegister = false;
request.patientMobileNumber = int.parse(mobileNo); request.patientMobileNumber = int.parse(mobileNo);
@ -166,15 +172,16 @@ class _Login extends State<Login> {
request.patientID = int.parse(nationalIDorFile.text); request.patientID = int.parse(nationalIDorFile.text);
} }
sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
GifLoaderDialogUtils.showMyDialog(context);
authService authService
.checkPatientAuthentication(request) .checkPatientAuthentication(request)
.then((value) => { .then((value) => {
//showLoader(false), //showLoader(false),
GifLoaderDialogUtils.hideDialog(context),
if (value['isSMSSent']) if (value['isSMSSent'])
{ {
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
GifLoaderDialogUtils.hideDialog(context),
Navigator.of(context).pushNamed(CONFIRM_LOGIN) Navigator.of(context).pushNamed(CONFIRM_LOGIN)
} }
else else
@ -183,10 +190,10 @@ class _Login extends State<Login> {
} }
}) })
.catchError((err) { .catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err); print(err);
AppToast.showErrorToast(message: err); GifLoaderDialogUtils.hideDialog(context);
}); });
// SMSOTP.showLoadingDialog(context, false),
} }
checkActivationCode({code}) async { checkActivationCode({code}) async {
@ -207,7 +214,6 @@ class _Login extends State<Login> {
request['PatientIdentificationID'] = ''; request['PatientIdentificationID'] = '';
request['PatientID'] = int.parse(nationalIDorFile.text); request['PatientID'] = int.parse(nationalIDorFile.text);
} }
GifLoaderDialogUtils.showMyDialog(context);
// request.isRegister = false; // request.isRegister = false;
this.authService.checkActivationCode(request, code).then((result) => { this.authService.checkActivationCode(request, code).then((result) => {
result = CheckActivationCode.fromJson(result), result = CheckActivationCode.fromJson(result),
@ -215,15 +221,11 @@ class _Login extends State<Login> {
this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(USER_PROFILE, result.list),
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
this.sharedPref.setString(TOKEN, result.authenticationTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID),
GifLoaderDialogUtils.hideDialog(context),
//this.checkIfUserAgreedBefore(result),
Navigator.of(context).pushNamed(
HOME,
),
//showLoader(false),
appointmentRateViewModel appointmentRateViewModel
.getIsLastAppointmentRatedList() .getIsLastAppointmentRatedList()
.then((value) => { .then((value) => {
GifLoaderDialogUtils.hideDialog(context),
if (appointmentRateViewModel.isHaveAppointmentNotRate) if (appointmentRateViewModel.isHaveAppointmentNotRate)
{ {
Navigator.pushReplacement( Navigator.pushReplacement(
@ -244,10 +246,10 @@ class _Login extends State<Login> {
} }
}) })
.catchError((err) { .catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err); print(err);
AppToast.showErrorToast(message: err); GifLoaderDialogUtils.hideDialog(context);
}) }),
// SMSOTP.showLoadingDialog(context, false),
}); });
} }

@ -172,7 +172,7 @@ class FamilyFilesProvider with ChangeNotifier {
throw error; throw error;
} }
} }
//TODO
Future<dynamic> checkActivationCode( Future<dynamic> checkActivationCode(
loginTokenID, activationCode, indentification, mobileNo) async { loginTokenID, activationCode, indentification, mobileNo) async {
try { try {

@ -16,7 +16,7 @@ class _GifLoaderContainerState extends State<GifLoaderContainer>
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
controller1.repeat( controller1.repeat(
min: 0, max: 12, period: Duration(milliseconds: 750), reverse: true); min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true);
}); });
super.initState(); super.initState();
} }

@ -243,7 +243,7 @@ class _TextFieldsState extends State<TextFields> {
onSaved: widget.onSaved, onSaved: widget.onSaved,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.body2 .bodyText1
.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight),
inputFormatters: widget.keyboardType == TextInputType.phone inputFormatters: widget.keyboardType == TextInputType.phone

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -35,6 +36,7 @@ class AppScaffold extends StatelessWidget {
final Widget floatingActionButton; final Widget floatingActionButton;
final String title; final String title;
final String description; final String description;
final String image;
final bool isShowDecPage; final bool isShowDecPage;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
@ -52,7 +54,7 @@ class AppScaffold extends StatelessWidget {
this.title, this.title,
this.description, this.description,
this.isShowDecPage = true, this.isShowDecPage = true,
this.isBottomBar}); this.isBottomBar, this.image});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -71,14 +73,24 @@ class AppScaffold extends StatelessWidget {
title: Texts(authenticatedUserObject.isLogin || !isShowDecPage title: Texts(authenticatedUserObject.isLogin || !isShowDecPage
? appBarTitle.toUpperCase() ? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,color: Colors.white,bold: true,), : TranslationBase.of(context).serviceInformationTitle,color: Colors.white,bold: true,),
leading: Builder( leading:Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return ArrowBack(); return ArrowBack();
}, },
), ),
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
IconButton( image!=null? InkWell(
onTap: ()=> Navigator.pop(context),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
image,
height: SizeConfig.heightMultiplier * 5,
width: SizeConfig.heightMultiplier * 5,
color: Colors.white,
),
),): IconButton(
icon: Icon(FontAwesomeIcons.home), icon: Icon(FontAwesomeIcons.home),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {

@ -29,6 +29,13 @@ class SMSOTP {
this.onFailure, this.onFailure,
); );
final verifyAccountForm = GlobalKey<FormState>();
TextEditingController digit1 = TextEditingController(text: "");
TextEditingController digit2 = TextEditingController(text: "");
TextEditingController digit3 = TextEditingController(text: "");
TextEditingController digit4 = TextEditingController(text: "");
Map verifyAccountFormValue = { Map verifyAccountFormValue = {
'digit1': '', 'digit1': '',
'digit2': '', 'digit2': '',
@ -42,6 +49,7 @@ class SMSOTP {
String errorMsg; String errorMsg;
String displayTime = ''; String displayTime = '';
displayDialog(BuildContext context) async { displayDialog(BuildContext context) async {
return showDialog( return showDialog(
context: context, context: context,
@ -83,65 +91,47 @@ class SMSOTP {
.substring(mobileNo.toString().length - 3), .substring(mobileNo.toString().length - 3),
textAlign: TextAlign.center, textAlign: TextAlign.center,
)), )),
Padding( Form(
padding: EdgeInsets.only(top: 20), key: verifyAccountForm,
child: Row( child: Padding(
mainAxisAlignment: MainAxisAlignment.spaceAround, padding: EdgeInsets.only(top: 20),
children: <Widget>[ child: Row(
Container( mainAxisAlignment: MainAxisAlignment.spaceAround,
width: SizeConfig.realScreenWidth * 0.15, children: <Widget>[
child: TextFormField( Container(
textInputAction: TextInputAction.next, width: SizeConfig.realScreenWidth * 0.15,
style: buildTextStyle(), child: TextFormField(
autofocus: true,
maxLength: 1,
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
decoration: buildInputDecoration(context),
onSaved: (val) {},
validator: validateCodeDigit,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusD2);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context).requestFocus(focusD2);
verifyAccountFormValue['digit1'] = val.trim();
checkValue();
}
},
),
),
Container(
width: SizeConfig.realScreenWidth * 0.15,
child: TextFormField(
focusNode: focusD2,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
style: buildTextStyle(),
autofocus: true,
maxLength: 1, maxLength: 1,
controller: digit1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: buildTextStyle(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: buildInputDecoration(context), decoration: buildInputDecoration(context),
onSaved: (val) {}, onSaved: (val) {},
validator: validateCodeDigit,
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusD3); FocusScope.of(context).requestFocus(focusD2);
}, },
onChanged: (val) { onChanged: (val) {
if (val.length == 1) { if (val.length == 1) {
FocusScope.of(context) FocusScope.of(context)
.requestFocus(focusD3); .requestFocus(focusD2);
verifyAccountFormValue['digit2'] = val.trim(); verifyAccountFormValue['digit1'] =
val.trim();
checkValue(); checkValue();
} }
}, },
validator: validateCodeDigit), ),
), ),
Container( Container(
width: SizeConfig.realScreenWidth * 0.15, width: SizeConfig.realScreenWidth * 0.15,
child: TextFormField( child: TextFormField(
focusNode: focusD3, focusNode: focusD2,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
maxLength: 1, maxLength: 1,
controller: digit2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: buildTextStyle(), style: buildTextStyle(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@ -149,38 +139,69 @@ class SMSOTP {
onSaved: (val) {}, onSaved: (val) {},
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context) FocusScope.of(context)
.requestFocus(focusD4); .requestFocus(focusD3);
}, },
onChanged: (val) { onChanged: (val) {
if (val.length == 1) { if (val.length == 1) {
FocusScope.of(context) FocusScope.of(context)
.requestFocus(focusD4); .requestFocus(focusD3);
verifyAccountFormValue['digit3'] = val.trim(); verifyAccountFormValue['digit2'] =
checkValue(); val.trim();
}
},
validator: validateCodeDigit)),
Container(
width: SizeConfig.realScreenWidth * 0.15,
child: TextFormField(
focusNode: focusD4,
maxLength: 1,
textAlign: TextAlign.center,
style: buildTextStyle(),
keyboardType: TextInputType.number,
decoration: buildInputDecoration(context),
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) {
if (val.length == 1) {
verifyAccountFormValue['digit4'] = val.trim();
checkValue(); checkValue();
} }
}, },
validator: validateCodeDigit)), validator: validateCodeDigit),
], ),
Container(
width: SizeConfig.realScreenWidth * 0.15,
child: TextFormField(
focusNode: focusD3,
textInputAction: TextInputAction.next,
maxLength: 1,
controller: digit3,
textAlign: TextAlign.center,
style: buildTextStyle(),
keyboardType: TextInputType.number,
decoration: buildInputDecoration(context),
onSaved: (val) {},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context)
.requestFocus(focusD4);
verifyAccountFormValue['digit3'] =
val.trim();
checkValue();
}
},
validator: validateCodeDigit)),
Container(
width: SizeConfig.realScreenWidth * 0.15,
child: TextFormField(
focusNode: focusD4,
maxLength: 1,
textAlign: TextAlign.center,
style: buildTextStyle(),
controller: digit4,
keyboardType: TextInputType.number,
decoration: buildInputDecoration(context),
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) {
if (val.length == 1) {
verifyAccountFormValue['digit4'] =
val.trim();
checkValue();
}
},
validator: validateCodeDigit)),
],
),
), ),
), ),
Padding( Padding(
@ -231,7 +252,7 @@ class SMSOTP {
String validateCodeDigit(value) { String validateCodeDigit(value) {
if (value.isEmpty) { if (value.isEmpty) {
return 'Please enter your Password'; return ' ';
} else if (value.length == 3) { } else if (value.length == 3) {
print(value); print(value);
} else { } else {
@ -241,15 +262,10 @@ class SMSOTP {
checkValue() { checkValue() {
//print(verifyAccountFormValue); //print(verifyAccountFormValue);
if (verifyAccountFormValue['digit1'] != ''&& if (verifyAccountForm.currentState.validate()) {
verifyAccountFormValue['digit2'] != '' && onSuccess(digit1.text.toString()+digit2.text.toString()+digit3.text.toString()+digit4.text.toString());
verifyAccountFormValue['digit3'] != '' &&
verifyAccountFormValue['digit4'] != '') {
onSuccess(verifyAccountFormValue['digit1'] +
verifyAccountFormValue['digit2'] +
verifyAccountFormValue['digit3'] +
verifyAccountFormValue['digit4']);
} }
} }
getSecondsAsDigitalClock(int inputSeconds) { getSecondsAsDigitalClock(int inputSeconds) {

Loading…
Cancel
Save