From d449086f9a9f3e691a5a328ab6bb0a8d7eccf31a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 8 Jul 2020 17:08:24 +0300 Subject: [PATCH 1/3] Fixing Clinic name in app reopening --- lib/providers/auth_provider.dart | 5 +++++ lib/screens/dashboard_screen.dart | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index eeef77e3..f288d696 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import 'package:doctor_app_flutter/config/config.dart'; @@ -14,6 +15,8 @@ class AuthProvider with ChangeNotifier { String selectedClinicName; bool isLogin = false; bool isLoading = true; + DoctorProfileModel doctorProfile; + AuthProvider() { getUserAuthentication(); } @@ -21,6 +24,7 @@ class AuthProvider with ChangeNotifier { void getUserAuthentication() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { + doctorProfile = new DoctorProfileModel.fromJson(profile); isLoading = false; isLogin = true; } else { @@ -117,6 +121,7 @@ class AuthProvider with ChangeNotifier { localRes = response; selectedClinicName = ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; + notifyListeners(); response['List_DoctorsClinic'].forEach((v) { doctorsClinicList.add(new ClinicModel.fromJson(v)); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index cab257e0..f94cad17 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -52,8 +52,9 @@ class _DashboardScreenState extends State { bool isLoading = false; ProjectProvider projectsProvider; var _isInit = true; + DoctorProfileModel profile; - void didChangeDependencies() { + void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { projectsProvider = Provider.of(context); @@ -73,6 +74,7 @@ class _DashboardScreenState extends State { authProvider = Provider.of(context); projectsProvider = Provider.of(context); FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } @@ -97,8 +99,10 @@ class _DashboardScreenState extends State { margin: EdgeInsets.only(left: 10, top: 10), child: AppText( authProvider.selectedClinicName != null - ? authProvider.selectedClinicName - : '', + ? //"Hussam Real" + authProvider.selectedClinicName + : authProvider.doctorProfile.clinicDescription, +// fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, ), From 0444d6803cb22b9d517c2ff980d191e944226477 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 12 Jul 2020 15:44:16 +0300 Subject: [PATCH 2/3] verification Screen Fixed --- lib/providers/auth_provider.dart | 1 - lib/widgets/auth/verfiy_account.dart | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index f288d696..ae7b4cbe 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -122,7 +122,6 @@ class AuthProvider with ChangeNotifier { selectedClinicName = ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - notifyListeners(); response['List_DoctorsClinic'].forEach((v) { doctorsClinicList.add(new ClinicModel.fromJson(v)); }); diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index a93c2b11..8c4aa224 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -42,6 +42,10 @@ class _VerifyAccountState extends State { AuthProvider authProv; bool _isInit = true; var model; + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); @override void initState() { @@ -103,6 +107,7 @@ class _VerifyAccountState extends State { style: buildTextStyle(), autofocus: true, maxLength: 1, + controller: digit1, textAlign: TextAlign.center, keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -126,6 +131,7 @@ class _VerifyAccountState extends State { width: SizeConfig.realScreenWidth * 0.20, child: TextFormField( focusNode: focusD2, + controller: digit2, textInputAction: TextInputAction.next, maxLength: 1, textAlign: TextAlign.center, @@ -153,6 +159,7 @@ class _VerifyAccountState extends State { width: SizeConfig.realScreenWidth * 0.20, child: TextFormField( focusNode: focusD3, + controller: digit3, textInputAction: TextInputAction.next, maxLength: 1, textAlign: TextAlign.center, @@ -179,6 +186,7 @@ class _VerifyAccountState extends State { width: SizeConfig.realScreenWidth * 0.20, child: TextFormField( focusNode: focusD4, + controller: digit4, maxLength: 1, textAlign: TextAlign.center, style: buildTextStyle(), @@ -246,6 +254,7 @@ class _VerifyAccountState extends State { if (value.isEmpty) { return 'Please enter your Password'; } + return null; } @@ -335,7 +344,9 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit3'] + verifyAccountFormValue['digit4']; print(activationCode); + int projectID = await sharedPref.getInt(PROJECT_ID); + Map model = { "activationCode": activationCode, "DoctorID": _loggedUser['DoctorID'], @@ -353,7 +364,7 @@ class _VerifyAccountState extends State { }; authProv.memberCheckActivationCodeNew(model).then((res) { - // changeLoadingStata(false); + //changeLoadingStata(false); if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { From b6d2cdb1dbb01aac5319dd96c8838a895df5eac0 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 13 Jul 2020 10:44:43 +0300 Subject: [PATCH 3/3] fixing clinic name in app reopening --- lib/screens/dashboard_screen.dart | 4 +--- lib/widgets/auth/verfiy_account.dart | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index f94cad17..40bb07b6 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -99,10 +99,8 @@ class _DashboardScreenState extends State { margin: EdgeInsets.only(left: 10, top: 10), child: AppText( authProvider.selectedClinicName != null - ? //"Hussam Real" - authProvider.selectedClinicName + ? authProvider.selectedClinicName : authProvider.doctorProfile.clinicDescription, -// fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, ), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 8c4aa224..f7ccfa5c 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -343,7 +343,6 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit2'] + verifyAccountFormValue['digit3'] + verifyAccountFormValue['digit4']; - print(activationCode); int projectID = await sharedPref.getInt(PROJECT_ID); @@ -364,7 +363,6 @@ class _VerifyAccountState extends State { }; authProv.memberCheckActivationCodeNew(model).then((res) { - //changeLoadingStata(false); if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) {