From c9538c6a84024f620df3f816d2105e2d847029a9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Fri, 25 Dec 2020 04:42:31 +0300 Subject: [PATCH 1/2] family files --- lib/widgets/drawer/app_drawer_widget.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index aea97d40..e42c1a2c 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -114,6 +114,8 @@ class _AppDrawerState extends State { padding: EdgeInsets.only( left: 30, right: 10), child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( TranslationBase.of( @@ -182,7 +184,7 @@ class _AppDrawerState extends State { case ConnectionState.waiting: return Padding( padding: EdgeInsets.all(10), - child: Text('Loading....')); + child: Text('')); default: if (snapshot.hasError) return Padding( From 8becd4f920ecf07e0f427f3d77c4e7cbc41e0b0a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 27 Dec 2020 09:59:53 +0300 Subject: [PATCH 2/2] login issue fixed --- lib/pages/landing/landing_page.dart | 2 +- lib/pages/login/login.dart | 88 +++++----- lib/pages/login/register.dart | 260 ++++++++++++++-------------- 3 files changed, 175 insertions(+), 175 deletions(-) diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e8a995a3..68eee783 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -154,7 +154,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { _firebaseMessaging.getToken().then((String token) async { sharedPref.setString(PUSH_TOKEN, token); - if (token != null && await sharedPref.getObject(USER_PROFILE) == null) { + if (token != null && projectViewModel.isLogin == false) { DEVICE_TOKEN = token; checkUserStatus(token); } else if (projectViewModel.isLogin) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 46f52280..5c4b3406 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -99,6 +99,7 @@ class _Login extends State { textDirection: TextDirection.ltr, child: Container( child: TextFields( + keyboardType: TextInputType.number, fontWeight: FontWeight.normal, controller: nationalIDorFile, onChanged: (value) => {validateForm()}, @@ -240,50 +241,49 @@ class _Login extends State { request['PatientID'] = int.parse(nationalIDorFile.text); } // request.isRegister = false; - this.authService.checkActivationCode(request, code).then((result) async{ - sharedPref.remove(FAMILY_FILE); - result = CheckActivationCode.fromJson(result); - result.list.isFamily = false; - // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), - this.sharedPref.setObject(USER_PROFILE, result.list); - this.sharedPref.setObject(MAIN_USER, result.list); - this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); - this.sharedPref.setString(TOKEN, result.authenticationTokenID); - await authenticatedUserObject.getUser(getUser: true); - authenticatedUserObject.isLogin = true; - appointmentRateViewModel.isLogin = true; - projectViewModel.isLogin = true; - projectViewModel.user = authenticatedUserObject.user; - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - getToDoCount(), - GifLoaderDialogUtils.hideDialog(context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - } - }) - .catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - }); - - }); + this.authService.checkActivationCode(request, code).then((result) async { + sharedPref.remove(FAMILY_FILE); + result = CheckActivationCode.fromJson(result); + result.list.isFamily = false; + // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), + this.sharedPref.setObject(USER_PROFILE, result.list); + this.sharedPref.setObject(MAIN_USER, result.list); + this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); + this.sharedPref.setString(TOKEN, result.authenticationTokenID); + await authenticatedUserObject.getUser(getUser: true); + authenticatedUserObject.isLogin = true; + appointmentRateViewModel.isLogin = true; + projectViewModel.isLogin = true; + projectViewModel.user = authenticatedUserObject.user; + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + getToDoCount(), + GifLoaderDialogUtils.hideDialog(context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); + }); } getToDoCount() { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 9245d6c3..34337411 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -50,135 +50,136 @@ class _Register extends State { isShowAppBar: true, isShowDecPage: false, body: SingleChildScrollView( - child: Container( - padding: - EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3, - textAlign: TextAlign.left, - )), - Expanded( - flex: 4, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Directionality( - textDirection:TextDirection.ltr,child:Container( - child: TextFields( - controller: nationalIDorFile, - onChanged: (value) => validateForm(), - prefixIcon: - Icon(Icons.chrome_reader_mode, color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: TranslationBase.of(context).nationalID, - ))), - Row( + child: Container( + padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column(children: [ + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context).enterNationalId, + fontSize: SizeConfig.textMultiplier * 3, + textAlign: TextAlign.left, + )), + Expanded( + flex: 4, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + MobileNo( + onNumberChange: (value) => + {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value), + Directionality( + textDirection: TextDirection.ltr, + child: Container( + child: TextFields( + controller: nationalIDorFile, + onChanged: (value) => validateForm(), + keyboardType: TextInputType.number, + prefixIcon: Icon(Icons.chrome_reader_mode, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: TranslationBase.of(context).nationalID, + ))), + Row( + children: [ + Expanded( + child: Row( children: [ - Expanded( - child: Row( - children: [ - Radio( - value: 1, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - validateForm(); - }, - ), - Text(TranslationBase.of(context).hijriDate), - ], - ), + Radio( + value: 1, + groupValue: isHijri, + onChanged: (value) { + setState(() { + isHijri = value; + }); + validateForm(); + }, ), - Expanded( - child: Row( - children: [ - Radio( - value: 0, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - validateForm(); - }, - ), - Text(TranslationBase.of(context) - .gregorianDate), - ], - ), + Text(TranslationBase.of(context).hijriDate), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 0, + groupValue: isHijri, + onChanged: (value) { + setState(() { + isHijri = value; + }); + validateForm(); + }, ), + Text(TranslationBase.of(context).gregorianDate), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( width: SizeConfig.realScreenWidth * .9, - height:60, - child: isHijri == 1 - ? TextFields( - onChanged: (value) => {dob = value}, - hintText: 'DD/MM/YYYY', - prefixIcon: Icon(Icons.date_range), - ) - : RaisedButton.icon( - shape: RoundedRectangleBorder( + height: 60, + child: isHijri == 1 + ? TextFields( + onChanged: (value) => {dob = value}, + hintText: 'DD/MM/YYYY', + prefixIcon: Icon(Icons.date_range), + ) + : RaisedButton.icon( + shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), - - ), - color:Colors.white, - onPressed: () => { - if (isHijri != null) - _selectDate(context) - }, - icon: Icon(Icons.date_range), - label: Text(selectedDate != null - ? "${selectedDate.toLocal()}" - .split(' ')[0] - : TranslationBase.of(context).dob))) - ]) + ), + color: Colors.white, + onPressed: () => { + if (isHijri != null) + _selectDate(context) + }, + icon: Icon(Icons.date_range), + label: Text(selectedDate != null + ? "${selectedDate.toLocal()}" + .split(' ')[0] + : TranslationBase.of(context).dob))) + ]) + ], + ), + ), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => {startRegistration()}, + textColor: Colors.white, + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[900])) ], ), - ), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox(height: 10,), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => {startRegistration()}, - textColor: Colors.white, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900])) - ], - ), - ], - )) - ]), - ))); + ], + )) + ]), + ))); } Future _selectDate(BuildContext context) async { @@ -216,7 +217,8 @@ class _Register extends State { this .authService .checkPatientForRegisteration(request) - .then((response) => {checkUserStatus(response, request)}).catchError((err) { + .then((response) => {checkUserStatus(response, request)}) + .catchError((err) { GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -224,15 +226,13 @@ class _Register extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - ConfirmDialog.closeAlertDialog(context), - Navigator.of(context).pushNamed( - REGISTER, - ), - - }, + ConfirmDialog.closeAlertDialog(context), + Navigator.of(context).pushNamed( + REGISTER, + ), + }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - }); } @@ -257,7 +257,7 @@ class _Register extends State { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { - // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); AlertDialogBox( context: context, confirmMessage: response['ErrorEndUserMessage'], @@ -308,7 +308,7 @@ class _Register extends State { request.isHijri = isHijri; request.patientOutSA = countryCode == '966' ? 0 : 1; this.authService.checkUserStatus(request).then((result) => { - GifLoaderDialogUtils.hideDialog(context), + GifLoaderDialogUtils.hideDialog(context), if (result is Map) { result = CheckUserStatusResponse.fromJson(result),