From f05b235cd06a70da4e6b01692fb1f4e388daa1e8 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 12 Nov 2020 08:14:57 +0300 Subject: [PATCH 01/18] login issue --- lib/config/config.dart | 7 +-- lib/core/service/client/base_app_client.dart | 18 ++++--- .../check_activation_code_request.dart | 2 +- .../send_activation_request.dart | 2 +- .../components/DocAvailableAppointments.dart | 2 +- .../Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/pages/login/confirm-login.dart | 49 +++++++++++++------ lib/pages/login/register-info.dart | 48 +++++++----------- .../authentication/auth_provider.dart | 7 ++- .../family_files/family_files_provider.dart | 19 ++++--- 10 files changed, 86 insertions(+), 70 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f37bbaea..c4ac1bdb 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -182,7 +182,8 @@ const CHECK_PAYMENT_STATUS = //URL create advance payment const CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; -const HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; +const HIS_CREATE_ADVANCE_PAYMENT = + "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; const ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; @@ -242,8 +243,8 @@ const LANGUAGE = 2; const PATIENT_OUT_SA = 0; const SESSION_ID = 'TMRhVmkGhOsvamErw'; const IS_DENTAL_ALLOWED_BACKEND = false; -const PATIENT_TYPE = 1; -const PATIENT_TYPE_ID = 1; +const PATIENT_TYPE = 2; +const PATIENT_TYPE_ID = 2; var DEVICE_TOKEN = ""; var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 17467dfb..0d2dda35 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -19,7 +19,9 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = locator(); +AuthenticatedUserObject authenticatedUserObject = + locator(); + class BaseAppClient { post(String endPoint, {Map body, @@ -66,21 +68,24 @@ class BaseAppClient { body['PatientType'] = body.containsKey('PatientType') ? body['PatientType'] != null ? body['PatientType'] - : PATIENT_TYPE + : user['PatientType'] != null + ? user['PatientType'] + : null : PATIENT_TYPE; body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null ? body['PatientTypeID'] - : PATIENT_TYPE_ID + : user['PatientTypeID'] != null + ? user['PatientTypeID'] + : null : PATIENT_TYPE_ID; - if (user != null) { body['TokenID'] = token; body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID;//getSessionId(token); + body['SessionID'] = SESSION_ID; //getSessionId(token); } } @@ -117,12 +122,11 @@ class BaseAppClient { onFailure( parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); - } } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - }else if (!parsed['IsAuthenticated']) { + } else if (!parsed['IsAuthenticated']) { await logout(); //helpers.showErrorToast('Your session expired Please login agian'); diff --git a/lib/models/Authentication/check_activation_code_request.dart b/lib/models/Authentication/check_activation_code_request.dart index a4bf79c3..af139ba5 100644 --- a/lib/models/Authentication/check_activation_code_request.dart +++ b/lib/models/Authentication/check_activation_code_request.dart @@ -2,7 +2,7 @@ class CheckActivationCodeReq { int patientMobileNumber; String mobileNo; String deviceToken; - int projectOutSA; + bool projectOutSA; int loginType; String zipCode; bool isRegister; diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index 804f6ef0..b53e19b8 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -2,7 +2,7 @@ class SendActivationRequest { int patientMobileNumber; String mobileNo; String deviceToken; - int projectOutSA; + bool projectOutSA; int loginType; String zipCode; bool isRegister; diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 8d0cc84d..85569473 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -235,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events, holidays) { + onDaySelected: (date, events) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 1e1fc444..939198c3 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event, holidays) { + onDaySelected: (date, event) { _onDaySelected( date, event, diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 2e1ba46b..b6e4dd22 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -291,7 +291,9 @@ class _ConfirmLogin extends State { checkUserAuthentication(type) { showLoader(true); - var req = getCommonRequest(); + var req = getCommonRequest(type: type); + req.logInTokenID = ""; + var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); GifLoaderDialogUtils.showMyDialog(context); @@ -317,12 +319,11 @@ class _ConfirmLogin extends State { .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); - }); } sendActivationCode(type) async { - var request = this.getCommonRequest(); + var request = this.getCommonRequest(type: type); GifLoaderDialogUtils.showMyDialog(context); await this.authService.sendActivationCode(request).then((result) { GifLoaderDialogUtils.hideDialog(context); @@ -353,10 +354,16 @@ class _ConfirmLogin extends State { localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true); - print(authenticated); + if (authenticated == true) { - var request = this.getCommonRequest(); + + if(user.logInType==2 || user.logInType ==3){ + this.checkActivationCode(); + }else{ + var request = this.getCommonRequest(type: type); this.getMobileInfo(request); + } + } } } @@ -445,30 +452,40 @@ class _ConfirmLogin extends State { //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); } - getCommonRequest() { + getCommonRequest({type}) { var request = SendActivationRequest(); request.patientMobileNumber = this.mobileNumber; request.mobileNo = '0' + this.mobileNumber.toString(); request.deviceToken = this.deviceToken; - request.projectOutSA = this.patientOutSA == true ? 1 : 0; + request.projectOutSA = this.patientOutSA == true ? true : false; request.loginType = this.selectedOption; - request.oTPSendType = this.selectedOption == 1 ? 1 : 2; + request.oTPSendType = + type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; request.zipCode = this.zipCode; request.logInTokenID = this.loginTokenID ?? ""; if (this.registerd_data != null) { - request.searchType = this.registerd_data.searchType ?? 1; - request.patientID = this.registerd_data.patientID ?? 0; + request.searchType = this.registerd_data.searchType != null + ? this.registerd_data.searchType + : 1; + request.patientID = this.registerd_data.patientID != null + ? this.registerd_data.patientID + : 0; request.patientIdentificationID = request.nationalID = - this.registerd_data.patientIdentificationID ?? '0'; + this.registerd_data.patientIdentificationID != null + ? this.registerd_data.patientIdentificationID + : '0'; request.isRegister = this.registerd_data.isRegister; } else { - request.searchType = request.searchType ?? 2; - request.patientID = this.user.patientID ?? 0; - request.nationalID = request.nationalID ?? '0'; - request.patientIdentificationID = request.patientIdentificationID ?? '0'; + request.searchType = request.searchType != null ? request.searchType : 2; + request.patientID = this.user.patientID != null ? this.user.patientID : 0; + request.nationalID = + request.nationalID != null ? request.nationalID : '0'; + request.patientIdentificationID = request.patientIdentificationID != null + ? request.patientIdentificationID + : '0'; request.isRegister = false; } request.deviceTypeID = request.searchType; @@ -520,7 +537,7 @@ class _ConfirmLogin extends State { checkIfUserAgreedBefore(CheckActivationCode result) { print(result); - if (result.isNeedUserAgreement ==true) { + if (result.isNeedUserAgreement == true) { //move to agreement page. } else { insertIMEI(); diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 83e4fc53..e4f69d0d 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -86,7 +86,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.firstNameEn, + hintText: registerInfo.firstNameEn == '-' + ? registerInfo.firstNameAr + : registerInfo.firstNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -95,7 +97,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.secondNameEn, + hintText: registerInfo.secondNameEn == '-' + ? registerInfo.secondNameAr + : registerInfo.secondNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -104,7 +108,9 @@ class _RegisterInfo extends State { Container( margin: EdgeInsets.only(bottom: 10), child: TextFields( - hintText: registerInfo.lastNameEn, + hintText: registerInfo.lastNameEn == '-' + ? registerInfo.lastNameAr + : registerInfo.lastNameEn, padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), readOnly: true, @@ -310,9 +316,15 @@ class _RegisterInfo extends State { "PatientIdentificationNo": registerInfo.idNumber, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, - "FirstName": registerInfo.firstNameEn, - "MiddleName": registerInfo.secondNameEn, - "LastName": registerInfo.lastNameEn, + "FirstName": registerInfo.firstNameEn == '-' + ? registerInfo.firstNameAr + : registerInfo.firstNameEn, + "MiddleName":registerInfo.secondNameEn == '-' + ? registerInfo.secondNameAr + : registerInfo.secondNameEn, + "LastName": registerInfo.lastNameEn == '-' + ? registerInfo.lastNameAr + : registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, "DateofBirth": DateUtil.convertISODateToJsonDate( registerInfo.dateOfBirth.replaceAll('/', '-')), @@ -331,30 +343,6 @@ class _RegisterInfo extends State { "PatientIdentificationID": registerInfo.idNumber, "PatientMobileNumber": registerd_data.patientMobileNumber, }; - - // var patientObject ={}; - // var request ={}; - // patientObject['PatientIdentificationType'] = this.identificationType; - // patientObject['PatientIdentificationNo'] = this.id; - // request['PatientIdentificationID'] = this.id; - // request['PatientMobileNumber'] = this.registerInfo.MobileNumber; - // patientObject['MobileNumber'] = this.registerInfo.MobileNumber; - // patientObject['PatientOutSA'] = this.registerInfo.PatientOutSA; - // request['LogInTokenID'] = this.registerInfo.LogInTokenID; - // request['activationCode'] = this.registerInfo.activationCode; - // request['ProjectID'] = this.selectedProjectID; - // patientObject['ProjectID'] = this.selectedProjectID; - // request - // request.setBirthDate(this.dateOfBirth, this.cs.convertISODateToJsonDate(this.dateOfBirth)); - // request.setGender(this.gender); - // request.Patientobject.NationalityID = this.selectedNationalityID; - // request.Patientobject.StrDateofBirth = this.dateOfBirth; - // request.Patientobject.DateofBirthN = this.dateHijri; - // request.Patientobject.EmailAddress = this.eMail; - // request.Patientobject.SourceType = this.iSOCountryID - // request.Patientobject.PreferredLanguage = this.preferredLanguage - // request.Patientobject.Marital = this.maritalStatus; - //return request; } bool isValid() { diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 8e4191ec..89231d20 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -233,7 +233,7 @@ class AuthProvider with ChangeNotifier { neRequest.languageID = LANGUAGE_ID; neRequest.deviceTypeID = DeviceTypeID; neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1; - neRequest.projectOutSA = neRequest.zipCode == '966' ? 0 : 1; + neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true; neRequest.isDentalAllowedBackend = false; neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false; @@ -345,11 +345,14 @@ class AuthProvider with ChangeNotifier { request.gender = user.gender; request.patientID = user.patientID; request.patientOutSA = user.outSA; - request.loginType = await sharedPref.getInt(LAST_LOGIN) ?? 1; + request.loginType = await sharedPref.getInt(LAST_LOGIN) != null + ? await sharedPref.getInt(LAST_LOGIN) + : 1; request.mACAddress = '00:00:00:00:00:00'; request.latitude = lat; request.longitude = long; request.languageID = int.parse(user.preferredLanguage); + request.patientTypeID = 2; dynamic localRes; try { await new BaseAppClient().post(LOGGED_IN_USER_URL, diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 4e7c95d0..491d3421 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -64,7 +64,8 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserViewRequest(responseID) async { + Future getUserViewRequest( + responseID) async { try { dynamic localRes; Map request = {}; @@ -75,12 +76,13 @@ class FamilyFilesProvider with ChangeNotifier { }, onFailure: (String error, int statusCode) { return Future.error(error); }, body: request); - if(localRes!=null){ - sharedPref.setObject(FAMILY_FILE, localRes); - allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); - return Future.value(allSharedRecordsByStatusResponse);} - else - return Future.error("No Data"); + if (localRes != null) { + sharedPref.setObject(FAMILY_FILE, localRes); + allSharedRecordsByStatusResponse = + GetAllSharedRecordsByStatusResponse.fromJson(localRes); + return Future.value(allSharedRecordsByStatusResponse); + } else + return Future.error("No Data"); } catch (error) { print(error); return Future.error(error); @@ -157,7 +159,7 @@ class FamilyFilesProvider with ChangeNotifier { request.zipCode = zipCode; request.patientMobileNumber = int.parse(cellNumber); request.patientIdentificationID = patientIdentificationID; - request.projectOutSA = zipCode == '966' ? 0 : 1; + request.projectOutSA = zipCode == '966' ? false : true; request.loginType = request.searchType = 1; request.oTPSendType = 1; request.isRegister = false; @@ -175,6 +177,7 @@ class FamilyFilesProvider with ChangeNotifier { throw error; } } + //TODO Future checkActivationCode( loginTokenID, activationCode, indentification, mobileNo) async { From d1336eec8b71b3b1e28946a4324529416f5a9516 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Fri, 13 Nov 2020 07:01:57 +0300 Subject: [PATCH 02/18] login type --- lib/config/config.dart | 4 ++-- lib/core/service/client/base_app_client.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index c4ac1bdb..efb15b36 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,8 +6,8 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -//const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Doctor diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 0d2dda35..da8b6ad6 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -70,7 +70,7 @@ class BaseAppClient { ? body['PatientType'] : user['PatientType'] != null ? user['PatientType'] - : null + : PATIENT_TYPE : PATIENT_TYPE; body['PatientTypeID'] = body.containsKey('PatientTypeID') @@ -78,7 +78,7 @@ class BaseAppClient { ? body['PatientTypeID'] : user['PatientTypeID'] != null ? user['PatientTypeID'] - : null + : PATIENT_TYPE_ID : PATIENT_TYPE_ID; if (user != null) { body['TokenID'] = token; From 283473a06a0eb8aedff4d62eccbdf4074800a8e3 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 14 Nov 2020 07:35:23 +0300 Subject: [PATCH 03/18] theme changes --- lib/config/localized_values.dart | 37 +++ lib/main.dart | 42 +-- lib/pages/landing/home_page.dart | 14 +- lib/pages/landing/landing_page.dart | 19 +- lib/pages/settings/general_setting.dart | 73 +++-- lib/pages/settings/profile_setting.dart | 336 ++++++++++++----------- lib/theme/theme_notifier.dart | 15 + lib/theme/theme_value.dart | 116 ++++++++ lib/uitl/translations_delegate_base.dart | 26 ++ 9 files changed, 442 insertions(+), 236 deletions(-) create mode 100644 lib/theme/theme_notifier.dart create mode 100644 lib/theme/theme_value.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 62b6ab53..3d05f41b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -823,4 +823,41 @@ const Map localizedValues = { "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, + "language-setting": { + "en": "SMS and Confirmation Calls Language", + "ar": "لغة الرسائل القصيرة و الاتصال الآلي" + }, + "alert": {"en": "Alerts", "ar": "التنبيهات"}, + "email-alert": { + "en": "Alert By Email", + "ar": "استلام التنبيهات بالبريد الالكتروني" + }, + "sms-alert": { + "en": "Alert By SMS", + "ar": "استلام التنبيهات بالرسائل القصيرة" + }, + "contact-info": {"en": "Contact Information", "ar": "معلومات التواصل"}, + "emrg-name": { + "en": "Emergency Contact Name", + "ar": "اسم للتواصل في حالة الطوارئ" + }, + "emrg-no": { + "en": "Emergency Contact Number", + "ar": "رقم للتواصل في حالة الطوارئ" + }, + "modes": {"en": "Modes", "ar": "الاوضاع"}, + "vibration": {"en": "Vibration Touch Feedback", "ar": "الاهتزاز عند اللمس"}, + "blind-modes": { + "en": "Modes for Partially Blind", + "ar": "تأثيرات لدعم ضعاف البصر" + }, + "invert-theme": {"en": "Invert", "ar": "ألوان سلبية"}, + "off-theme": {"en": "Off", "ar": "إيقاف"}, + "dim-theme": {"en": "Dim", "ar": "ضوء خافت"}, + "bw-theme": {"en": "Black and White", "ar": "أبيض و أسود"}, + "permissions": {"en": "Permission", "ar": "الصلاحيات"}, + "camera-permission": {"en": "Camera", "ar": "الكاميرا"}, + "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, + + "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, }; diff --git a/lib/main.dart b/lib/main.dart index bd310dbc..8678cd83 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -14,13 +16,14 @@ import 'locator.dart'; void main() async { setupLocator(); - runApp(MyApp()); + runApp(ChangeNotifierProvider( + create: (_) => ThemeNotifier(defaultTheme), child: MyApp())); } class MyApp extends StatelessWidget { - /// static final _myTabbedPageKey = new GlobalKey<_LandingPageState>(); @override Widget build(BuildContext context) { + final themeNotifier = Provider.of(context); return LayoutBuilder( builder: (context, constraints) { return OrientationBuilder( @@ -58,40 +61,7 @@ class MyApp extends StatelessWidget { const Locale('ar', ''), // Arabic const Locale('en', ''), // English ], - theme: ThemeData( - fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, - visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, - pageTransitionsTheme: const PageTransitionsTheme( - builders: { - TargetPlatform.android: ZoomPageTransitionsBuilder(), - TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - }, - ), - hintColor: Colors.grey[400], - disabledColor: Colors.grey[300], - errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), - textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), - highlightColor: Colors.grey[100].withOpacity(0.4), - splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.grey, - iconTheme: IconThemeData(), - appBarTheme: AppBarTheme( - color: Color(0xff40ACC9), - brightness: Brightness.dark, - elevation: 10.0, - actionsIconTheme: IconThemeData( - color: Color(0xff40ACC9), - ), - ), - ), + theme: themeNotifier.getTheme(), initialRoute: SPLASH, routes: routes, debugShowCheckedModeBanner: false, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index abb5c06a..b047885e 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -42,13 +42,13 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { ToDoCountProviderModel toDoProvider; - @override - void initState() { - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - getToDoCount(); - }); - super.initState(); - } + // @override + // void initState() { + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // getToDoCount(); + // }); + // super.initState(); + // } AuthenticatedUserObject authenticatedUserObject = locator(); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 609f6b2c..6c90e59f 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -83,7 +83,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { print(route.settings.name); } - setState(() { + //setState(() { print("didChangeAppLifecycleState"); print('state = $state'); AppGlobal.context = context; @@ -111,7 +111,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (state == AppLifecycleState.inactive) { isPageNavigated = false; } - }); + //}); } @override @@ -124,9 +124,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - setState(() { + //setState(() { AppGlobal.context = context; - }); + // }); _requestIOSPermissions(); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); @@ -137,7 +137,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); - if (token != null) { + if (token != null && DEVICE_TOKEN =="") { DEVICE_TOKEN = token; checkUserStatus(token); } @@ -425,11 +425,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) - authService.registeredAuthenticatedUser(data, token, 0, 0); - // setState(() { - // this.user = data; - // print(this.user); - // }); + authService + .registeredAuthenticatedUser(data, token, 0, 0) + .then((res) => {print(res)}); + } } diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index ef1ec052..b8cf8742 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,7 +1,11 @@ +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class GeneralSettings extends StatefulWidget { @override @@ -10,15 +14,18 @@ class GeneralSettings extends StatefulWidget { class _GeneralSettings extends State with TickerProviderStateMixin { + var themeNotifier; + int blindValue = 0; Widget build(BuildContext context) { bool isVibration = true; - var bindValue; + + themeNotifier = Provider.of(context); return Container( child: ListView(scrollDirection: Axis.vertical, children: [ Container( padding: EdgeInsets.all(10), child: AppText( - 'Modes', + TranslationBase.of(context).modes, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -29,7 +36,7 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Vibration touch feedback'), + Text(TranslationBase.of(context).vibration), Switch( value: isVibration, onChanged: (value) { @@ -48,7 +55,7 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Accsibility Mode'), + AppText(TranslationBase.of(context).accessibility), Switch( value: isVibration, onChanged: (value) { @@ -64,7 +71,7 @@ class _GeneralSettings extends State Container( padding: EdgeInsets.all(10), child: AppText( - 'Modes for Partially Blind', + TranslationBase.of(context).blindMode, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -82,14 +89,15 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Off', + TranslationBase.of(context).offTheme, style: new TextStyle(fontSize: 16.0), ), - new Radio( + Radio( value: 0, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ), ], @@ -98,16 +106,17 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Invert', + TranslationBase.of(context).invertTheme, style: new TextStyle( fontSize: 16.0, ), ), new Radio( value: 1, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ) ], @@ -116,14 +125,15 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Dim', + TranslationBase.of(context).dimTheme, style: new TextStyle(fontSize: 16.0), ), new Radio( value: 2, - groupValue: bindValue, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + setTheme(value); }, ), ], @@ -132,14 +142,16 @@ class _GeneralSettings extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - 'Black and White', + TranslationBase.of(context).bwTheme, style: new TextStyle(fontSize: 16.0), ), new Radio( - value: 2, - groupValue: bindValue, + value: 3, + groupValue: blindValue, onChanged: (value) { - bindValue = value; + setState(() => {this.blindValue = value}); + + setTheme(value); }, ), ], @@ -150,7 +162,7 @@ class _GeneralSettings extends State Container( padding: EdgeInsets.all(10), child: AppText( - 'Permission', + TranslationBase.of(context).permissions, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -161,7 +173,7 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Camera'), + AppText(TranslationBase.of(context).cameraPermission), Switch( value: isVibration, onChanged: (value) { @@ -180,7 +192,7 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Location'), + AppText(TranslationBase.of(context).locationPermission), Switch( value: isVibration, onChanged: (value) { @@ -195,4 +207,21 @@ class _GeneralSettings extends State )) ])); } + + setTheme(value) { + switch (value) { + case 0: + themeNotifier.setTheme(defaultTheme); + break; + case 1: + themeNotifier.setTheme(invertTheme); + break; + case 2: + themeNotifier.setTheme(dimTheme); + break; + default: + themeNotifier.setTheme(defaultTheme); + break; + } + } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 3a8f01dc..0658e2e6 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -15,168 +17,180 @@ class _ProfileSettings extends State Widget build(BuildContext context) { bool isVibration = true; var language = 1; - return Container( - child: ListView(scrollDirection: Axis.vertical, children: [ - Container( - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - 'File No', - color: Colors.black, - ), - AppText( - '124545', - color: Colors.black, - ), - ], - ), - ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], - ), - ), - Padding( - child: AppText('SMS and Confirmation Calls Language ', - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('English'), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - language = value; - }, - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Arabic'), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - language = value; - }, - ) - ], - )), - Padding( - child: AppText('Alert'), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Alert by Email'), - Switch( - value: isVibration, - onChanged: (value) { - setState(() { - isVibration = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Alert by SMS'), - Switch( - value: isVibration, - onChanged: (value) { - setState(() { - isVibration = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText('Alert'), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Email'), - TextField( - style: TextStyle(color: Colors.red), - ) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Emergency contact name'), - TextField( - style: TextStyle(color: Colors.red), - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('Emergency contact number'), - TextField( - style: TextStyle(color: Colors.red), - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), + return BaseView( + onModelReady: (model) => model.getPatientRadOrders(), + builder: (_, model, wi) => Container( + child: + ListView(scrollDirection: Axis.vertical, children: [ + Container( + padding: EdgeInsets.all(15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + ), + AppText( + model.user.patientID.toString(), + color: Colors.black, + ), + ], + ), + ), + SizedBox( + height: 1, + width: MediaQuery.of(context).size.width, + child: Container( + color: Colors.grey[300], ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).submit, - () { + ), + Padding( + child: AppText(TranslationBase.of(context).languageSetting, + fontWeight: FontWeight.bold), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).english), + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + language = value; + }, + ) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).arabic), + new Radio( + value: 1, + groupValue: language, + onChanged: (value) { + language = value; + }, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).alert), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).emailAlert), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).smsAlert), + Switch( + value: isVibration, + onChanged: (value) { + setState(() { + isVibration = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).contactInfo), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).email), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).emergencyName), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: + EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).emergencyContact), + TextField( + style: TextStyle(color: Colors.red), + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + ), + ) + ], + )), + Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).submit, + () { // print(mobileNo.text); - }, - )), - ], - )) - ])); + }, + )), + ], + )) + ]))); } } diff --git a/lib/theme/theme_notifier.dart b/lib/theme/theme_notifier.dart new file mode 100644 index 00000000..98e24cf5 --- /dev/null +++ b/lib/theme/theme_notifier.dart @@ -0,0 +1,15 @@ +import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:flutter/material.dart'; + +class ThemeNotifier with ChangeNotifier { + ThemeData _themeData = defaultTheme; + + ThemeNotifier(this._themeData); + + getTheme() => _themeData; + + setTheme(ThemeData themeData) async { + _themeData = themeData; + notifyListeners(); + } +} diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart new file mode 100644 index 00000000..1d84ee11 --- /dev/null +++ b/lib/theme/theme_value.dart @@ -0,0 +1,116 @@ +import 'dart:ui'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +/// ---- Default Theme ---- +/// + +//final projectProvider = Provider.of(AppGlobal.context); +final bluePrimary = Color(0xFF3F51B5); +final blueAccent = Color(0xFFFF9800); +final blueBackground = Color(0xFFFFFFFF); +final defaultTheme = ThemeData( + // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), +); + +final invertTheme = ThemeData( + // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.black, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.dark, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.white, + disabledColor: Colors.white, + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.white, + canvasColor: Colors.white, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff000000), + brightness: Brightness.dark, + elevation: 5.0, + actionsIconTheme: IconThemeData( + color: Color(0xff000000), + ), + ), +); + +final dimTheme = ThemeData( + // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.dark, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), +); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6029f46d..a32f335f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -776,6 +776,32 @@ class TranslationBase { localizedValues['month-report'][locale.languageCode]; String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + String get languageSetting => + localizedValues['language-setting'][locale.languageCode]; + String get alert => localizedValues['alert'][locale.languageCode]; + String get emailAlert => localizedValues['email-alert'][locale.languageCode]; + String get smsAlert => localizedValues['sms-alert'][locale.languageCode]; + String get contactInfo => + localizedValues['contact-info'][locale.languageCode]; + String get emergencyName => localizedValues['emrg-name'][locale.languageCode]; + String get emergencyContact => + localizedValues['emrg-no'][locale.languageCode]; + String get modes => localizedValues['modes'][locale.languageCode]; + String get vibration => localizedValues['vibration'][locale.languageCode]; + String get blindMode => localizedValues['blind-modes'][locale.languageCode]; + String get invertTheme => + localizedValues['invert-theme'][locale.languageCode]; + String get offTheme => localizedValues['off-theme'][locale.languageCode]; + String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; + String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; + + String get permissions => localizedValues['permissions'][locale.languageCode]; + String get cameraPermission => + localizedValues['camera-permission'][locale.languageCode]; + String get locationPermission => + localizedValues['location-permission'][locale.languageCode]; + String get accessibility => + localizedValues['accessibility'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 58b1f648c195274f9406ef3343b5ab4a9afb7e65 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 15 Nov 2020 07:36:45 +0300 Subject: [PATCH 04/18] setting theme --- lib/pages/login/login.dart | 20 +++++++-- lib/pages/settings/general_setting.dart | 36 ++++++++++------ lib/theme/theme_value.dart | 57 ++++++++++++++----------- pubspec.yaml | 2 +- 4 files changed, 74 insertions(+), 41 deletions(-) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index dd4911e1..8fdbb15e 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -64,7 +65,7 @@ class _Login extends State { @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, @@ -196,6 +197,19 @@ class _Login extends State { }) .catchError((err) { print(err); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + Navigator.of(context).pushNamed( + REGISTER, + ), + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); GifLoaderDialogUtils.hideDialog(context); }); // SMSOTP.showLoadingDialog(context, false), @@ -226,10 +240,10 @@ class _Login extends State { this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), authenticatedUserObject.getUser(), - // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), + // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), authenticatedUserObject.isLogin = true, appointmentRateViewModel.isLogin = true, - projectViewModel.isLogin = true, + projectViewModel.isLogin = true, appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index b8cf8742..275b8748 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:screen/screen.dart'; class GeneralSettings extends StatefulWidget { @override @@ -16,8 +17,11 @@ class _GeneralSettings extends State with TickerProviderStateMixin { var themeNotifier; int blindValue = 0; + bool vibration =false; + bool accessibility =false; + bool camera =false; + bool location =false ; Widget build(BuildContext context) { - bool isVibration = true; themeNotifier = Provider.of(context); return Container( @@ -36,12 +40,12 @@ class _GeneralSettings extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(TranslationBase.of(context).vibration), + AppText(TranslationBase.of(context).vibration), Switch( - value: isVibration, + value: vibration, onChanged: (value) { setState(() { - isVibration = value; + vibration = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -57,10 +61,10 @@ class _GeneralSettings extends State children: [ AppText(TranslationBase.of(context).accessibility), Switch( - value: isVibration, + value: accessibility, onChanged: (value) { setState(() { - isVibration = value; + accessibility = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -96,7 +100,7 @@ class _GeneralSettings extends State value: 0, groupValue: blindValue, onChanged: (value) { - setState(() => {this.blindValue = value}); + setState(() => {this.blindValue = value}); setTheme(value); }, ), @@ -175,10 +179,10 @@ class _GeneralSettings extends State children: [ AppText(TranslationBase.of(context).cameraPermission), Switch( - value: isVibration, + value: camera, onChanged: (value) { setState(() { - isVibration = value; + camera = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -194,10 +198,10 @@ class _GeneralSettings extends State children: [ AppText(TranslationBase.of(context).locationPermission), Switch( - value: isVibration, + value: location, onChanged: (value) { setState(() { - isVibration = value; + location = value; }); }, activeTrackColor: Colors.lightGreenAccent, @@ -212,15 +216,23 @@ class _GeneralSettings extends State switch (value) { case 0: themeNotifier.setTheme(defaultTheme); + Screen.setBrightness(1.0); break; case 1: themeNotifier.setTheme(invertTheme); + Screen.setBrightness(1.0); break; case 2: - themeNotifier.setTheme(dimTheme); + //themeNotifier.setTheme(dimTheme); + Screen.setBrightness(0.01); + break; + case 3: + themeNotifier.setTheme(bwTheme); + Screen.setBrightness(1.0); break; default: themeNotifier.setTheme(defaultTheme); + Screen.setBrightness(1.0); break; } } diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index 1d84ee11..703ea8f4 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -28,12 +28,13 @@ final defaultTheme = ThemeData( textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), + backgroundColor: Colors.white, highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff40ACC9), bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), cursorColor: Colors.grey, + cardColor: Colors.white, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( color: Color(0xff40ACC9), @@ -47,70 +48,76 @@ final defaultTheme = ThemeData( final invertTheme = ThemeData( // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.black, + primarySwatch: Colors.grey, visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.dark, + brightness: Brightness.light, pageTransitionsTheme: const PageTransitionsTheme( builders: { TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), }, ), - hintColor: Colors.white, - disabledColor: Colors.white, + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), + scaffoldBackgroundColor: Colors.grey, textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.white, + textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), + backgroundColor: Colors.grey, highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), + primaryColor: Colors.grey, bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), cursorColor: Colors.grey, + iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Color(0xff000000), + color: Colors.grey, brightness: Brightness.dark, - elevation: 5.0, + elevation: 10.0, actionsIconTheme: IconThemeData( - color: Color(0xff000000), + color: Colors.grey, ), ), ); -final dimTheme = ThemeData( +final bwTheme = ThemeData( // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, + primarySwatch: Colors.black54, visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.dark, + brightness: Brightness.light, pageTransitionsTheme: const PageTransitionsTheme( builders: { TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), }, ), - hintColor: Colors.grey[400], - disabledColor: Colors.grey[300], + hintColor: Colors.black54, + cardColor:Colors.black54, + buttonColor: Colors.black54, + disabledColor: Colors.black54, errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), + scaffoldBackgroundColor: Colors.black54, textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), + textSelectionHandleColor: Colors.black54, + canvasColor:Colors.black54, + backgroundColor: Colors.black54, highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), + primaryColor: Colors.black54, bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.grey, + cursorColor: Colors.black54, + iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Color(0xff40ACC9), + color: Colors.black54, brightness: Brightness.dark, elevation: 10.0, actionsIconTheme: IconThemeData( - color: Color(0xff40ACC9), + color: Colors.black54, ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 80855c8b..cef4f5b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -139,7 +139,7 @@ dependencies: #Handle Geolocation geolocator: ^6.0.0+1 - + screen: ^0.0.5 #google maps places google_maps_place_picker: ^1.0.0 From 3fef1b9d527c7103258904881f6baf54069a3529 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 15 Nov 2020 19:30:26 +0300 Subject: [PATCH 05/18] theme and login issues fixed --- lib/config/localized_values.dart | 22 +- lib/config/shared_pref_kay.dart | 2 + lib/core/service/client/base_app_client.dart | 2 +- lib/main.dart | 39 +++- lib/pages/login/login-type.dart | 11 +- lib/pages/login/login.dart | 5 + lib/pages/login/register.dart | 48 ++++- lib/pages/settings/general_setting.dart | 171 ++++++++++++++- lib/theme/theme_notifier.dart | 4 +- lib/theme/theme_value.dart | 214 ++++++++++--------- lib/uitl/translations_delegate_base.dart | 2 + lib/widgets/buttons/defaultButton.dart | 2 +- lib/widgets/mobile-no/mobile_no.dart | 16 +- lib/widgets/otp/sms-popup.dart | 13 +- pubspec.yaml | 1 - 15 files changed, 404 insertions(+), 148 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3d05f41b..7a265b13 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -111,10 +111,13 @@ const Map localizedValues = { 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'تسجيل الدخول'}, 'poweredBy': {'en': 'Powered By', 'ar': 'مشغل بواسطة'}, - 'welcome': {'en': 'Welcome', 'ar': 'أهلا بك'}, - 'welcome_text': { - 'en': 'Dr. Sulaiman Al Habib Mobile Application ', - 'ar': 'الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك' + "welcome": { + "en": "Welcome", + "ar": "مرحبا" + }, + "welcome_text": { + "en": "Dr. Sulaiman Al Habib Mobile Application", + "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك" }, 'welcome_text2': { 'en': 'Have you visited AlHabib Medical Group before? ', @@ -127,7 +130,12 @@ const Map localizedValues = { "ar": "اختر من الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي." }, "registernow": {"en": "Register Now", "ar": "تسجيل الان"}, - "nationalID": {"en": "National ID", "ar": "رقم الهوية"}, + "nationalID": { "en": "Enter the Identification Number", + "ar": "أدخل رقم الهوية الوطنية او الاقامة"}, + "national-id": { + "en": "National ID", + "ar": "رقم الهوية" + }, "fileNo": {"en": "File Number", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, "forgotFileNoTitle": { @@ -136,8 +144,8 @@ const Map localizedValues = { }, "enter-national-id": { - "en": "Please enter mobile number and national ID / Iqama", - "ar": "الرجاء إدخال رقم الجوال والهوية الوطنية / الاقامة" + "en": "Please enter mobile number and identification number", + "ar": "الرجاء إدخال رقم الجوال ورقم الهوية" }, "profile-info": { "en": "Please enter profile information", diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 7422052d..84c6a36e 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -16,3 +16,5 @@ const USER_LONG = 'user-long'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; const IS_SEARCH_APPO = 'is-search-appo'; const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; +const IS_VIBRATION = 'is_vibration'; +const THEME_VALUE = 'is_vibration'; \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index da8b6ad6..d899ea5e 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -33,7 +33,7 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') diff --git a/lib/main.dart b/lib/main.dart index 8678cd83..e6fc0bfa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,12 +17,13 @@ import 'locator.dart'; void main() async { setupLocator(); runApp(ChangeNotifierProvider( - create: (_) => ThemeNotifier(defaultTheme), child: MyApp())); + create: (context) => ThemeNotifier(defaultTheme), child: MyApp() )); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + final themeNotifier = Provider.of(context); return LayoutBuilder( builder: (context, constraints) { @@ -61,7 +62,41 @@ class MyApp extends StatelessWidget { const Locale('ar', ''), // Arabic const Locale('en', ''), // English ], - theme: themeNotifier.getTheme(), + theme: ThemeData( + fontFamily: projectProvider.isArabic? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.white, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + cardColor: Colors.white, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), + ), initialRoute: SPLASH, routes: routes, debugShowCheckedModeBanner: false, diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index edd1bf3d..dcd58b9d 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -14,7 +14,7 @@ class LoginType extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).welcome, + appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, isShowDecPage: false, body: Padding( @@ -73,7 +73,7 @@ class LoginType extends StatelessWidget { ), AppText( TranslationBase.of(context) - .nationalID, + .idNo, fontSize: SizeConfig.textMultiplier * 2, @@ -122,6 +122,7 @@ class LoginType extends StatelessWidget { )))) ], ), + SizedBox(height: 25,), Divider( color: Colors.grey, height: 2, @@ -144,8 +145,14 @@ class LoginType extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ + Expanded( child: DefaultButton( TranslationBase.of(context).registerNow, diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 8fdbb15e..7d6f24ee 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -117,6 +117,11 @@ class _Login extends State { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ Expanded( diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 03e7e1ca..eb88c598 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -8,11 +8,13 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.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/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -46,9 +48,7 @@ class _Register extends State { appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, isShowDecPage: false, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( + body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), @@ -120,8 +120,12 @@ class _Register extends State { ), ], ), - Row(children: [ - Expanded( + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + width: SizeConfig.realScreenWidth * .9, + height:60, child: isHijri == 1 ? TextFields( onChanged: (value) => {dob = value}, @@ -129,6 +133,11 @@ class _Register extends State { prefixIcon: Icon(Icons.date_range), ) : RaisedButton.icon( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + + ), + color:Colors.white, onPressed: () => { if (isHijri != null) _selectDate(context) @@ -147,6 +156,11 @@ class _Register extends State { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox(height: 10,), Row( children: [ Expanded( @@ -196,7 +210,7 @@ class _Register extends State { } checkPatientForRegisteration(request) { - showLoader(true); + GifLoaderDialogUtils.showMyDialog(context); this .authService .checkPatientForRegisteration(request) @@ -219,12 +233,20 @@ class _Register extends State { } checkUserStatus(response, CheckPatientForRegistration request) async { - showLoader(false); + GifLoaderDialogUtils.hideDialog(context); if (response is Map) { 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'], + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + }).showAlertDialog(context); } else { nRequest['forRegister'] = true; nRequest['isRegister'] = true; @@ -236,7 +258,15 @@ class _Register extends State { } } else { // if (response['ErrorCode'] == '-986') { - AppToast.showErrorToast(message: response); + //AppToast.showErrorToast(message: response); + AlertDialogBox( + context: context, + confirmMessage: response, + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + }).showAlertDialog(context); //} } } diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 275b8748..5e174fbc 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -20,7 +22,16 @@ class _GeneralSettings extends State bool vibration =false; bool accessibility =false; bool camera =false; - bool location =false ; + bool location =false; + var sharedPref = new AppSharedPreferences(); + + @override + void initState() { + getValues(); + super.initState(); + } + + Widget build(BuildContext context) { themeNotifier = Provider.of(context); @@ -46,7 +57,9 @@ class _GeneralSettings extends State onChanged: (value) { setState(() { vibration = value; + }); + setVibration(value); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -212,28 +225,164 @@ class _GeneralSettings extends State ])); } - setTheme(value) { + setTheme(value) async{ switch (value) { case 0: - themeNotifier.setTheme(defaultTheme); - Screen.setBrightness(1.0); + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } break; case 1: - themeNotifier.setTheme(invertTheme); - Screen.setBrightness(1.0); + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } break; case 2: - //themeNotifier.setTheme(dimTheme); + themeNotifier.setTheme(await getTheme(value)); Screen.setBrightness(0.01); break; case 3: - themeNotifier.setTheme(bwTheme); - Screen.setBrightness(1.0); + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } break; default: - themeNotifier.setTheme(defaultTheme); - Screen.setBrightness(1.0); + { + themeNotifier.setTheme(await getTheme(value)); + Screen.setBrightness(1.0); + } break; } + sharedPref.setInt(THEME_VALUE, value); + + } + setVibration(value){ + sharedPref.setBool(IS_VIBRATION, value); + } + + getValues() async{ + blindValue= await sharedPref.getInt(THEME_VALUE) ?? 0; + vibration= await sharedPref.getBool(IS_VIBRATION) ?? false; + } + getTheme(value) async{ + if(value ==1){ + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.grey, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + + }else if(value ==3){ + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.black45, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); + + }else { + return ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.white, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + cardColor: Colors.white, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), + ); + + } } } diff --git a/lib/theme/theme_notifier.dart b/lib/theme/theme_notifier.dart index 98e24cf5..e414d159 100644 --- a/lib/theme/theme_notifier.dart +++ b/lib/theme/theme_notifier.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:flutter/material.dart'; class ThemeNotifier with ChangeNotifier { ThemeData _themeData = defaultTheme; - ThemeNotifier(this._themeData); - getTheme() => _themeData; setTheme(ThemeData themeData) async { _themeData = themeData; + notifyListeners(); } } diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index 703ea8f4..d19e13b2 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -1,5 +1,8 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -10,114 +13,117 @@ import 'package:provider/provider.dart'; final bluePrimary = Color(0xFF3F51B5); final blueAccent = Color(0xFFFF9800); final blueBackground = Color(0xFFFFFFFF); -final defaultTheme = ThemeData( - // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, - visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, - pageTransitionsTheme: const PageTransitionsTheme( - builders: { - TargetPlatform.android: ZoomPageTransitionsBuilder(), - TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - }, - ), - hintColor: Colors.grey[400], - disabledColor: Colors.grey[300], - errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), - textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Colors.white, - highlightColor: Colors.grey[100].withOpacity(0.4), - splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.grey, - cardColor: Colors.white, - iconTheme: IconThemeData(), - appBarTheme: AppBarTheme( - color: Color(0xff40ACC9), - brightness: Brightness.dark, - elevation: 10.0, - actionsIconTheme: IconThemeData( - color: Color(0xff40ACC9), + +// ProjectViewModel projectProvider = Provider.of(AppGlobal.context); + final bwTheme = ThemeData( + //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, ), - ), -); + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, -final invertTheme = ThemeData( - // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.grey, - visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, - pageTransitionsTheme: const PageTransitionsTheme( - builders: { - TargetPlatform.android: ZoomPageTransitionsBuilder(), - TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - }, - ), - hintColor: Colors.grey[400], - cardColor: Colors.black, - buttonColor: Colors.grey[400], - disabledColor: Colors.grey[300], - errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Colors.grey, - textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Colors.grey, - highlightColor: Colors.grey[100].withOpacity(0.4), - splashColor: Colors.transparent, - primaryColor: Colors.grey, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.grey, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.black45, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + ); - iconTheme: IconThemeData(), - appBarTheme: AppBarTheme( - color: Colors.grey, - brightness: Brightness.dark, - elevation: 10.0, - actionsIconTheme: IconThemeData( - color: Colors.grey, + final defaultTheme = ThemeData( + //fontFamily: ProjectViewModel().isArabic? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, ), - ), -); + hintColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xffEEEEEE), + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.white, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff40ACC9), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + cardColor: Colors.white, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Color(0xff40ACC9), + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Color(0xff40ACC9), + ), + ), + ); -final bwTheme = ThemeData( - // fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.black54, - visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, - pageTransitionsTheme: const PageTransitionsTheme( - builders: { - TargetPlatform.android: ZoomPageTransitionsBuilder(), - TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - }, - ), - hintColor: Colors.black54, - cardColor:Colors.black54, - buttonColor: Colors.black54, - disabledColor: Colors.black54, - errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Colors.black54, - textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.black54, - canvasColor:Colors.black54, - backgroundColor: Colors.black54, - highlightColor: Colors.grey[100].withOpacity(0.4), - splashColor: Colors.transparent, - primaryColor: Colors.black54, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.black54, + final invertTheme = ThemeData( + //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, - iconTheme: IconThemeData(), - appBarTheme: AppBarTheme( - color: Colors.black54, - brightness: Brightness.dark, - elevation: 10.0, - actionsIconTheme: IconThemeData( - color: Colors.black54, + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.grey, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), ), - ), -); + ); + diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a32f335f..078ce069 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -145,6 +145,8 @@ class TranslationBase { String get nationalID => localizedValues['nationalID'][locale.languageCode]; + String get idNo => localizedValues['national-id'][locale.languageCode]; + String get fileNo => localizedValues['fileNo'][locale.languageCode]; String get forgotPassword => diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index bc56f474..228fdce7 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -15,7 +15,7 @@ class DefaultButton extends StatelessWidget { child: RaisedButton( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - color: color != null ? color : Colors.grey[700], + color: color != null ? color : Colors.grey[900], textColor: color != null ? textColor : Colors.white, child: Text( this.text, diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index d3e62153..2bb12a68 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; // OWNER : Ibrahim albitar // DATE : 12-04-2020 @@ -10,8 +12,10 @@ class MobileNo extends StatefulWidget { // final String data; final List countries = [ - new Countries(name: 'Saudi Arabia', code: '966'), - new Countries(name: 'Dubai', code: '971'), + new Countries( name: "Saudi Arabia", + name_ar:"المملكة العربية السعودية", code: '966' ), + new Countries(name: "United Arab Emirates", + name_ar:"الإمارات العربية المتحدة", code: '971'), ]; final double margin; final double marginTop; @@ -40,9 +44,10 @@ class MobileNo extends StatefulWidget { class _MobileNo extends State { var _selectedType = '966'; String countryCode = '966'; - + ProjectViewModel projectProvider; @override Widget build(BuildContext context) { + projectProvider = Provider.of(context); return Visibility( child: Column(children: [ Row( @@ -79,7 +84,7 @@ class _MobileNo extends State { .map>((Countries value) { return DropdownMenuItem( value: value.code, - child: Text(value.name), + child: Text(projectProvider.isArabic == true ? value.name_ar : value.name), ); }).toList())))), ], @@ -133,7 +138,8 @@ class _MobileNo extends State { class Countries { final String name; + final String name_ar; final String code; - Countries({this.name, this.code}); + Countries({this.name, this.name_ar, this.code}); } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 8400cca3..39e41a93 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -1,11 +1,14 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'dart:math'; +import 'package:provider/provider.dart'; + class SMSOTP { final type; final mobileNo; @@ -47,13 +50,15 @@ class SMSOTP { final focusD3 = FocusNode(); final focusD4 = FocusNode(); String errorMsg; - + ProjectViewModel projectProvider; String displayTime = ''; displayDialog(BuildContext context) async { + return showDialog( context: context, builder: (context) { + projectProvider = Provider.of(context); return AlertDialog( title: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -95,7 +100,9 @@ class SMSOTP { key: verifyAccountForm, child: Padding( padding: EdgeInsets.only(top: 20), - child: Row( + child: Directionality( + textDirection:TextDirection.ltr, + child:Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( @@ -201,7 +208,7 @@ class SMSOTP { }, validator: validateCodeDigit)), ], - ), + )), ), ), Padding( diff --git a/pubspec.yaml b/pubspec.yaml index cef4f5b2..af3c6673 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,6 @@ dependencies: shared_preferences: ^0.5.8 flutter_flexible_toast: ^0.1.4 firebase_messaging: ^7.0.0 - # Progress bar progress_hud_v2: ^2.0.0 percent_indicator: ^2.1.5 From 536682e95394041568a8ef5cb23607af8f88e71c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 16 Nov 2020 07:40:21 +0300 Subject: [PATCH 06/18] merge --- lib/uitl/translations_delegate_base.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 19ab8b5a..0d6b4c9a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -791,8 +791,7 @@ class TranslationBase { String get modes => localizedValues['modes'][locale.languageCode]; String get vibration => localizedValues['vibration'][locale.languageCode]; String get blindMode => localizedValues['blind-modes'][locale.languageCode]; - String get invertTheme => - localizedValues['invert-theme'][locale.languageCode]; + String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; String get offTheme => localizedValues['off-theme'][locale.languageCode]; String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; From 0eedb788c380fbb395e33a3149e481681ff54792 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 16 Nov 2020 09:16:21 +0300 Subject: [PATCH 07/18] register page --- lib/pages/login/register-info.dart | 55 +++++++++++++++++++++++------- lib/pages/login/register.dart | 19 ++++++++++- 2 files changed, 60 insertions(+), 14 deletions(-) diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index e4f69d0d..f0eb8e83 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -8,9 +8,11 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -208,7 +210,7 @@ class _RegisterInfo extends State { child: DropdownButtonHideUnderline( child: DropdownButton( isExpanded: true, - value: language, + value: location, iconSize: 40, elevation: 16, onChanged: (value) => { @@ -275,17 +277,47 @@ class _RegisterInfo extends State { registerNow() { dynamic request = getTempUserRequest(); - + GifLoaderDialogUtils.showMyDialog(context); this.authService.registerUser(request).then((result) => { - print(result), + GifLoaderDialogUtils.hideDialog(context), // userData = result.list; //AuthenticatedUser.fromJson(result['List'][0]), + if(result is String){ + new ConfirmDialog( + context: context, + confirmMessage: result, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}) + .showAlertDialog(context) + + }else + { sharedPref.setObject(USER_PROFILE, result.list), sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), Navigator.of(context).pushNamed(HOME) - }); + } + }).catchError((err) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + Navigator.of(context).pushNamed( + REGISTER, + ), + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + GifLoaderDialogUtils.hideDialog(context); + }); } getRegisterInfo() async { @@ -316,15 +348,12 @@ class _RegisterInfo extends State { "PatientIdentificationNo": registerInfo.idNumber, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, - "FirstName": registerInfo.firstNameEn == '-' - ? registerInfo.firstNameAr - : registerInfo.firstNameEn, - "MiddleName":registerInfo.secondNameEn == '-' - ? registerInfo.secondNameAr - : registerInfo.secondNameEn, - "LastName": registerInfo.lastNameEn == '-' - ? registerInfo.lastNameAr - : registerInfo.lastNameEn, + "FirstNameN":registerInfo.firstNameAr =='-' ?"": registerInfo.firstNameAr, + "FirstName": registerInfo.firstNameEn =='-' ?"":registerInfo.firstNameEn, + "MiddleNameN":registerInfo.secondNameAr =='-' ? "" : registerInfo.secondNameAr, + "MiddleName":registerInfo.secondNameEn == '-' ? "": registerInfo.secondNameEn, + "LastNameN": registerInfo.lastNameAr =='-'? "" : registerInfo.lastNameAr, + "LastName": registerInfo.lastNameEn =='-' ? "": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, "DateofBirth": DateUtil.convertISODateToJsonDate( registerInfo.dateOfBirth.replaceAll('/', '-')), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index eb88c598..56293aea 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -214,7 +215,23 @@ class _Register extends State { this .authService .checkPatientForRegisteration(request) - .then((response) => {checkUserStatus(response, request)}); + .then((response) => {checkUserStatus(response, request)}).catchError((err) { + print(err); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + Navigator.of(context).pushNamed( + REGISTER, + ), + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + GifLoaderDialogUtils.hideDialog(context); + }); } void validateForm() { From a16145d7f181cfd586700c02a4166072283272f0 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 16 Nov 2020 12:58:33 +0300 Subject: [PATCH 08/18] bugfixes --- .../Authentication/register_user_requet.dart | 16 ++++++++++++++-- lib/pages/login/login.dart | 7 ++++--- lib/pages/login/register-info.dart | 8 +++----- lib/pages/login/register.dart | 7 ++++--- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/models/Authentication/register_user_requet.dart b/lib/models/Authentication/register_user_requet.dart index ebefcfcf..7758ce5b 100644 --- a/lib/models/Authentication/register_user_requet.dart +++ b/lib/models/Authentication/register_user_requet.dart @@ -76,6 +76,9 @@ class Patientobject { String firstName; String middleName; String lastName; + String firstNameN; + String middleNameN; + String lastNameN; dynamic strDateofBirth; String dateofBirth; int gender; @@ -93,8 +96,11 @@ class Patientobject { this.mobileNumber, this.patientOutSA, this.firstName, - this.middleName, - this.lastName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, this.strDateofBirth, this.dateofBirth, this.gender, @@ -114,6 +120,9 @@ class Patientobject { firstName = json['FirstName']; middleName = json['MiddleName']; lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; strDateofBirth = json['StrDateofBirth']; dateofBirth = json['DateofBirth']; gender = json['Gender']; @@ -136,6 +145,9 @@ class Patientobject { data['FirstName'] = this.firstName; data['MiddleName'] = this.middleName; data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; data['StrDateofBirth'] = this.strDateofBirth; data['DateofBirth'] = this.dateofBirth; data['Gender'] = this.gender; diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 7d6f24ee..0cd3ace4 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -201,21 +201,22 @@ class _Login extends State { } }) .catchError((err) { - print(err); + GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: err, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { + ConfirmDialog.closeAlertDialog(context), Navigator.of(context).pushNamed( REGISTER, ), - ConfirmDialog.closeAlertDialog(context) + }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - GifLoaderDialogUtils.hideDialog(context); + }); // SMSOTP.showLoadingDialog(context, false), } diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index f0eb8e83..e2a55663 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -303,20 +303,18 @@ class _RegisterInfo extends State { Navigator.of(context).pushNamed(HOME) } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: err, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - Navigator.of(context).pushNamed( - REGISTER, - ), - ConfirmDialog.closeAlertDialog(context) + ConfirmDialog.closeAlertDialog(context) }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - GifLoaderDialogUtils.hideDialog(context); + }); } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 56293aea..d2cd2081 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -216,21 +216,22 @@ class _Register extends State { .authService .checkPatientForRegisteration(request) .then((response) => {checkUserStatus(response, request)}).catchError((err) { - print(err); + GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: err, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { + ConfirmDialog.closeAlertDialog(context) Navigator.of(context).pushNamed( REGISTER, ), - ConfirmDialog.closeAlertDialog(context) + }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - GifLoaderDialogUtils.hideDialog(context); + }); } From d81cc7119d79ee475ec5800b6f68c66b05f28f8b Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 16 Nov 2020 16:42:36 +0300 Subject: [PATCH 09/18] insurance details --- lib/pages/insurance/insurance_details.dart | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/pages/insurance/insurance_details.dart diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart new file mode 100644 index 00000000..4d9abf81 --- /dev/null +++ b/lib/pages/insurance/insurance_details.dart @@ -0,0 +1,37 @@ +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/insurance/config/size_config.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:html2md/html2md.dart' as html2md; +import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class InsuranceCardDetails extends StatefulWidget { + final String data; + + InsuranceCardDetails({this.data}); + + @override + _InsuranceCardInsuranceCardDetailsState createState() => _InsuranceCardInsuranceCardDetailsState(); +} +//TODO fix it +class _InsuranceCardInsuranceCardDetailsState extends State { + @override + Widget build(BuildContext context) { + return + AppScaffold( + isShowAppBar: true, + + body: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04), + child:Markdown( + data: html2md.convert(widget.data), + ) + + ), + ); + } +} From bedafa24cd012ef6f64d2a70da707de1d53b5a2a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 16 Nov 2020 16:42:47 +0300 Subject: [PATCH 10/18] insurance details --- lib/config/config.dart | 4 ++++ lib/core/service/insurance_service.dart | 10 ++++++++++ lib/core/viewModels/insurance_card_View_model.dart | 1 + lib/core/viewModels/project_view_model.dart | 3 ++- lib/pages/insurance/insurance_card_screen.dart | 13 +++++++++++++ lib/pages/insurance/insurance_details.dart | 3 ++- lib/pages/login/register.dart | 2 +- lib/widgets/others/app_scaffold_widget.dart | 2 +- pubspec.yaml | 5 +++-- 9 files changed, 37 insertions(+), 6 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index efb15b36..1f260de8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -254,6 +254,10 @@ const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; + +const INSURANCE_DETAILS = + "Services/Patients.svc/REST/Get_InsuranceCheckList"; + const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; const GET_PAtIENTS_INSURANCE_APPROVALS = diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 02061612..04c63b0d 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -125,4 +125,14 @@ class InsuranceCardService extends BaseService { throw error; } } + Future getInsuranceDetails() async{ + dynamic localRes; + await baseAppClient.post(INSURANCE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } } diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index e99a53f6..62c45d1b 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -72,4 +72,5 @@ class InsuranceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + } diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 91e9b9a3..d2b7cf8b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -18,7 +18,8 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; - bool isLogin = false; + bool isLogin + = false; dynamic get searchValue => searchvalue; diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index a7065399..e37e8dae 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -1,11 +1,15 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,6 +25,7 @@ class InsuranceCard extends StatefulWidget { } //TODO fix it class _InsuranceCardState extends State { + InsuranceCardService _insuranceCardService = locator(); @override Widget build(BuildContext context) { return BaseView( @@ -140,6 +145,7 @@ class _InsuranceCardState extends State { Container( color: Colors.transparent, child: SecondaryButton( + onTap: getDetails(), label: TranslationBase.of(context).seeDetails, textColor: Colors.white, ), @@ -179,4 +185,11 @@ class _InsuranceCardState extends State { return newDate.toString(); } + getDetails(){ + _insuranceCardService.getInsuranceDetails().then((value) => { + Navigator.push(context, + FadePage(page: InsuranceCardDetails(data:value))) + + }); + } } diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart index 4d9abf81..0617dd61 100644 --- a/lib/pages/insurance/insurance_details.dart +++ b/lib/pages/insurance/insurance_details.dart @@ -1,5 +1,5 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/insurance/config/size_config.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:html2md/html2md.dart' as html2md; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -34,4 +34,5 @@ class _InsuranceCardInsuranceCardDetailsState extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - ConfirmDialog.closeAlertDialog(context) + ConfirmDialog.closeAlertDialog(context), Navigator.of(context).pushNamed( REGISTER, ), diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 86a07958..a807b02e 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -126,7 +126,7 @@ class AppScaffold extends StatelessWidget { description: description, infoList: infoList, ) - : baseViewModel != null + : baseViewModel != null ? NetworkBaseView( child: buildBodyWidget(), baseViewModel: baseViewModel, diff --git a/pubspec.yaml b/pubspec.yaml index af3c6673..72f34d11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -141,7 +141,7 @@ dependencies: screen: ^0.0.5 #google maps places google_maps_place_picker: ^1.0.0 - + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9 @@ -150,7 +150,8 @@ dependencies: after_layout: ^1.0.7 twilio_programmable_video: ^0.5.0+3 flutter_tts: ^1.2.6 - + html2md: "^0.5.1" + flutter_markdown: "^0.5.0" speech_to_text: path: speech_to_text From 1f4f81b454b38f7c95835cc8a30ca6ccd71e6b9a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 17 Nov 2020 07:37:42 +0300 Subject: [PATCH 11/18] insurance card details --- lib/core/model/insurance/insurance_card.dart | 6 ++++++ lib/core/service/insurance_service.dart | 7 ++++--- lib/pages/insurance/insurance_card_screen.dart | 8 ++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/core/model/insurance/insurance_card.dart b/lib/core/model/insurance/insurance_card.dart index 998df241..ebab8d71 100644 --- a/lib/core/model/insurance/insurance_card.dart +++ b/lib/core/model/insurance/insurance_card.dart @@ -16,7 +16,9 @@ class InsuranceCardModel { int patientType; String groupName; String companyName; + int companyID; String subCategoryDesc; + int subCategoryID; String patientCardID; String insurancePolicyNumber; bool isActive; @@ -25,6 +27,7 @@ class InsuranceCardModel { InsuranceCardModel({ this.insurancePolicyNumber, this.subCategoryDesc, + this.subCategoryID, this.versionID, this.channel, this.languageID, @@ -40,6 +43,7 @@ class InsuranceCardModel { this.patientType, this.groupName, this.companyName, + this.companyID, this.patientCardID, this.isActive, this.cardValidTo @@ -50,6 +54,7 @@ class InsuranceCardModel { insurancePolicyNumber = json['InsurancePolicyNo']; patientCardID = json['PatientCardID']; companyName = json['CompanyName']; + companyID = json['CompanyID']; groupName = json['GroupName']; versionID = json['VersionID']; channel = json['Channel']; @@ -65,6 +70,7 @@ class InsuranceCardModel { patientTypeID = json['PatientTypeID']; patientType = json['PatientType']; subCategoryDesc = json['SubCategoryDesc']; + subCategoryID = json["SubCategoryID"]; cardValidTo = json['CardValidTo']; } diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 04c63b0d..cc920646 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -125,14 +125,15 @@ class InsuranceCardService extends BaseService { throw error; } } - Future getInsuranceDetails() async{ + Future getInsuranceDetails(data) async{ dynamic localRes; await baseAppClient.post(INSURANCE_DETAILS, onSuccess: (dynamic response, int statusCode) { - localRes = response; + localRes = response['List_InsuranceCheckList']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body:{'CompanyID': data.companyID,'SubCategoryID':data.subCategoryID },); + return Future.value(localRes); } } diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index e37e8dae..f78b9f85 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -145,7 +145,7 @@ class _InsuranceCardState extends State { Container( color: Colors.transparent, child: SecondaryButton( - onTap: getDetails(), + onTap:()=>{ getDetails(model.insurance[index])}, label: TranslationBase.of(context).seeDetails, textColor: Colors.white, ), @@ -185,10 +185,10 @@ class _InsuranceCardState extends State { return newDate.toString(); } - getDetails(){ - _insuranceCardService.getInsuranceDetails().then((value) => { + getDetails(data){ + _insuranceCardService.getInsuranceDetails(data).then((value) => { Navigator.push(context, - FadePage(page: InsuranceCardDetails(data:value))) + FadePage(page: InsuranceCardDetails(data:value[0]['CheckList']))) }); } From 431306f0e153bb00332f58189125bb385ae4b386 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 17 Nov 2020 07:51:13 +0300 Subject: [PATCH 12/18] insurance details --- lib/pages/insurance/insurance_card_screen.dart | 3 +++ lib/pages/insurance/insurance_details.dart | 17 +++++++---------- pubspec.yaml | 3 +-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index f78b9f85..d5fac63f 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -186,7 +187,9 @@ class _InsuranceCardState extends State { return newDate.toString(); } getDetails(data){ + GifLoaderDialogUtils.showMyDialog(context); _insuranceCardService.getInsuranceDetails(data).then((value) => { + GifLoaderDialogUtils.hideDialog(context), Navigator.push(context, FadePage(page: InsuranceCardDetails(data:value[0]['CheckList']))) diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart index 0617dd61..d0a829be 100644 --- a/lib/pages/insurance/insurance_details.dart +++ b/lib/pages/insurance/insurance_details.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:html2md/html2md.dart' as html2md; -import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:html/dom.dart' as dom; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -22,15 +22,12 @@ class _InsuranceCardInsuranceCardDetailsState extends State Date: Tue, 17 Nov 2020 18:08:27 +0300 Subject: [PATCH 13/18] viral sign issue --- .../components/DocAvailableAppointments.dart | 6 +++--- lib/pages/Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/pages/landing/home_page.dart | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index eb82f6d1..70b6aaa0 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -224,7 +224,7 @@ class _DocAvailableAppointmentsState extends State ), ); }, - markersBuilder: (context, date, events, holidays) { + markersBuilder: (context, date, events, _) { final children = []; if (events.isNotEmpty) { children.add( @@ -239,8 +239,8 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events) { - _onDaySelected(date, events); + onDaySelected: (date, event, _) { + _onDaySelected(date, event); _animationController.forward(from: 0.0); }, onVisibleDaysChanged: _onVisibleDaysChanged, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 939198c3..3e58b657 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event) { + onDaySelected: (date, event, _) { _onDaySelected( date, event, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 6c1eea65..b2c421fe 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -57,7 +57,7 @@ class _HomePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientRadOrders(), + onModelReady: (model) => {},//model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( isShowDecPage: false, body: Container( From 91be66ecdd4177f8681faf1f34c8723f031ad634 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 18 Nov 2020 17:35:52 +0300 Subject: [PATCH 14/18] family file changes --- lib/config/localized_values.dart | 1 + lib/config/shared_pref_kay.dart | 3 +- .../Authentication/authenticated_user.dart | 5 +- lib/pages/DrawerPages/family/my-family.dart | 9 +- lib/pages/login/confirm-login.dart | 3 +- lib/pages/login/login.dart | 4 +- lib/pages/login/register-info.dart | 3 +- .../family_files/family_files_provider.dart | 56 +++++--- lib/uitl/translations_delegate_base.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 129 ++++++++++++------ 10 files changed, 145 insertions(+), 70 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f2de4bca..f489b24a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -137,6 +137,7 @@ const Map localizedValues = { "ar": "رقم الهوية" }, "fileNo": {"en": "File Number", "ar": "رقم الملف"}, + "fileno": {"en": "File No", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, "forgotFileNoTitle": { "en": "Forgot medical file Number", diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 84c6a36e..ac611c71 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -17,4 +17,5 @@ const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; const IS_SEARCH_APPO = 'is-search-appo'; const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; const IS_VIBRATION = 'is_vibration'; -const THEME_VALUE = 'is_vibration'; \ No newline at end of file +const THEME_VALUE = 'is_vibration'; +const MAIN_USER = 'main-user'; \ No newline at end of file diff --git a/lib/models/Authentication/authenticated_user.dart b/lib/models/Authentication/authenticated_user.dart index efccc068..4c7974a3 100644 --- a/lib/models/Authentication/authenticated_user.dart +++ b/lib/models/Authentication/authenticated_user.dart @@ -60,6 +60,7 @@ class AuthenticatedUser { dynamic strDateofBirth; dynamic tempAddress; dynamic zipCode; + dynamic isFamily; // dynamic patientPayType; // dynamic patientType; // dynamic status; @@ -123,6 +124,7 @@ class AuthenticatedUser { this.strDateofBirth, this.tempAddress, this.zipCode, + this.isFamily }); AuthenticatedUser.fromJson(Map json) { @@ -190,6 +192,7 @@ class AuthenticatedUser { strDateofBirth = json['StrDateofBirth']; tempAddress = json['TempAddress']; zipCode = json['ZipCode']; + isFamily = json['IsFamily']; } Map toJson() { @@ -255,7 +258,7 @@ class AuthenticatedUser { data['StrDateofBirth'] = this.strDateofBirth; data['TempAddress'] = this.tempAddress; data['ZipCode'] = this.zipCode; - + data['IsFamily'] = this.isFamily; return data; } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 535c09ce..d5fd81c1 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; @@ -512,17 +513,19 @@ class _MyFamily extends State with TickerProviderStateMixin { } switchUser(user, context) { - Utils.showProgressDialog(context); + GifLoaderDialogUtils.showMyDialog(context); this .familyFileProvider .silentLoggin(user) .then((value) => loginAfter(value, context)); } - loginAfter(result, context) { - Utils.hideProgressDialog(); + loginAfter(result, context) async{ + GifLoaderDialogUtils.hideDialog(context); + var familyFile = await sharedPref.getObject(FAMILY_FILE); result = CheckActivationCode.fromJson(result); this.sharedPref.clear(); + this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 1357c74f..94778902 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -511,8 +511,9 @@ class _ConfirmLogin extends State { } else { + result.list.isFamily = false, userData = result.list, - //AuthenticatedUser.fromJson(result['List'][0]), + sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 0cd3ace4..700a0d0c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -242,7 +242,9 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), - this.sharedPref.setObject(USER_PROFILE, result.list), + result.list.isFamily =false, + 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), authenticatedUserObject.getUser(), diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index e2a55663..467068cc 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -296,8 +296,9 @@ class _RegisterInfo extends State { }else { + result.list.isFamily = false, sharedPref.setObject(USER_PROFILE, result.list), - + this.sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), Navigator.of(context).pushNamed(HOME) diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 491d3421..79ea67d0 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -55,6 +55,7 @@ class FamilyFilesProvider with ChangeNotifier { AppToast.showErrorToast(message: error); throw error; }, body: request.toJson()); + sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( GetAllSharedRecordsByStatusResponse.fromJson(localRes)); @@ -246,29 +247,42 @@ class FamilyFilesProvider with ChangeNotifier { } Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, - {onSuccess}) async { - //var currentUser = this.authService.getAuthenticatedUser(); - var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - //const request = new SwitchUserRequest(); + {onSuccess, mainUser}) async { Map request = {}; - request['LogInTokenID'] = ''; - request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; - request['PatientMobileNumber'] = - switchUser.mobileNumber; //['MobileNumber']; - request['SearchType'] = 2; - request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; - request['PatientIdentificationID'] = ''; - request['IsSilentLogin'] = true; - if (switchUser.mobileNumber != null && - switchUser.patientID != currentUser.patientID) { - request['PatientID'] = switchUser.patientID; //['PatientID']; - } else { - request['PatientID'] = switchUser.responseID; //['ResponseID']; + if(mainUser ==true){ + var currentUser = + AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); + //const request = new SwitchUserRequest(); + request['LogInTokenID'] = ''; + request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; + request['PatientMobileNumber'] = + currentUser.mobileNumber; //['MobileNumber']; + request['SearchType'] = 2; + request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; + request['PatientIdentificationID'] = ''; + request['IsSilentLogin'] = true; + request['PatientID'] = currentUser.patientID; //['PatientID']; + request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; + request['activationCode'] = '0000'; + request['isRegister'] = false; + }else { + var currentUser = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + //const request = new SwitchUserRequest(); + + request['LogInTokenID'] = ''; + request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; + request['PatientMobileNumber'] = + switchUser.mobileNumber; //['MobileNumber']; + request['SearchType'] = 2; + request['SuperUser'] = switchUser.patientID; //currentUser.PatientID; + request['PatientIdentificationID'] = ''; + request['IsSilentLogin'] = true; + request['PatientID'] = switchUser.responseID; //['PatientID']; + request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; + request['activationCode'] = '0000'; + request['isRegister'] = false; } - request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; - request['activationCode'] = '0000'; - request['isRegister'] = false; try { dynamic localRes; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cde20c4d..30135b32 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -148,7 +148,7 @@ class TranslationBase { String get idNo => localizedValues['national-id'][locale.languageCode]; String get fileNo => localizedValues['fileNo'][locale.languageCode]; - +String get fileno => localizedValues['fileno'][locale.languageCode]; String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 66be3e48..da20f144 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -36,6 +36,7 @@ class _AppDrawerState extends State { var sharedPref = new AppSharedPreferences(); var familyFileProvider = FamilyFilesProvider(); AuthenticatedUser user; + AuthenticatedUser mainUser; AuthenticatedUserObject authenticatedUserObject = locator(); @@ -97,7 +98,7 @@ class _AppDrawerState extends State { child: Column( children: [ AppText( - 'File No:' + + TranslationBase.of(context).fileno +": " + user.patientID .toString(), color: @@ -188,49 +189,84 @@ class _AppDrawerState extends State { width: 1.0, ), )), - child: Column( + child: Column(children: [ + user.isFamily == true ? Container( + + padding: EdgeInsets + .only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser( + mainUser, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + Expanded( + child: Icon( + Icons.person), + ), + Expanded( + flex: + 7, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(mainUser.firstName +' '+mainUser.lastName), + AppText(TranslationBase.of(context).fileno +": " + mainUser.patientID.toString()), + ])), + ], + ))) : SizedBox(), + Column( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, mainAxisSize: - MainAxisSize.min, + MainAxisSize.min, children: snapshot.data .getAllSharedRecordsByStatusList .map((result) { return result.status == 3 - ? Padding( - padding: EdgeInsets - .only( - bottom: - 5), - child: InkWell( - onTap: () { - switchUser( - result, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Expanded( - child: Icon( - Icons.person), - ), - Expanded( - flex: - 7, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(result.patientName), - Text('File No:' + result.iD.toString()), - ])), - ], - ))) + ? Container( + + padding: EdgeInsets + .only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser( + result, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + Expanded( + child: Icon( + Icons.person, color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), + ), + Expanded( + flex: + 7, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(result.patientName, color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), + AppText(TranslationBase.of(context).fileno +": " + result.iD.toString(), color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), + ])), + ], + ))) : SizedBox(); - }).toList())); + }).toList())],)); } }, ), @@ -343,8 +379,13 @@ class _AppDrawerState extends State { if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( await this.sharedPref.getObject(USER_PROFILE)); + + var data2 = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(MAIN_USER)); + print(data2); setState(() { this.user = data; + this.mainUser = data2; }); } } @@ -371,6 +412,7 @@ class _AppDrawerState extends State { } Future getFamilyFiles() async { + if(user !=null){ if (await sharedPref.getObject(FAMILY_FILE) != null) { // print(await sharedPref.getObject(FAMILY_FILE)); return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( @@ -378,13 +420,14 @@ class _AppDrawerState extends State { } else { return familyFileProvider.getSharedRecordByStatus(); } + } } switchUser(user, context) { Utils.showProgressDialog(context); this .familyFileProvider - .silentLoggin(user) + .silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser) .then((value) => loginAfter(value, context)) .catchError((err) { print(err); @@ -392,14 +435,20 @@ class _AppDrawerState extends State { Navigator.of(context).pop(); }).showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); - ; } - loginAfter(result, context) { + loginAfter(result, context) async { Utils.hideProgressDialog(); result = CheckActivationCode.fromJson(result); + var familyFile = await sharedPref.getObject(FAMILY_FILE); + var mainUser = await sharedPref.getObject(MAIN_USER); this.sharedPref.clear(); + if(mainUser["PatientID"] != result.list.patientID) { + result.list.isFamily = true; + } + this.sharedPref.setObject(MAIN_USER,mainUser); this.sharedPref.setObject(USER_PROFILE, result.list); + this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); //this.checkIfUserAgreedBefore(result), From 00b0154987041214df2bdda9c2e7bf5748dbf1c5 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 19 Nov 2020 09:13:00 +0300 Subject: [PATCH 15/18] my family --- lib/pages/DrawerPages/family/my-family.dart | 132 ++++++++++---------- lib/pages/landing/landing_page.dart | 3 +- 2 files changed, 71 insertions(+), 64 deletions(-) diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index d5fd81c1..d3de1b62 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -20,6 +20,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/routes.dart'; class MyFamily extends StatefulWidget { + final bool isAppbarVisible; + MyFamily({this.isAppbarVisible =true}); @override _MyFamily createState() => _MyFamily(); } @@ -39,65 +41,66 @@ class _MyFamily extends State with TickerProviderStateMixin { bool expandFlag = false; Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - bottom: TabBar( - indicatorColor: Colors.red, - tabs: [ - Padding( - padding: EdgeInsets.all(6), - child: AppText( - TranslationBase.of(context).family, - color: Colors.white, - )), - Padding( - padding: EdgeInsets.all(6), - child: AppText( - TranslationBase.of(context).request, - color: Colors.white, - )), - ], - controller: _tabController, - ), - title: AppText(TranslationBase.of(context).myFamilyFiles, - color: Colors.white)), - body: TabBarView( - // physics: NeverScrollableScrollPhysics(), - children: [myFamilyDetails(context), myFamilyRequest(context)], - controller: _tabController), - bottomNavigationBar: BottomBarSearch()); + // return Scaffold( + // appBar: AppBar( + // bottom: TabBar( + // indicatorColor: Colors.red, + // tabs: [ + // Padding( + // padding: EdgeInsets.all(6), + // child: AppText( + // TranslationBase.of(context).family, + // color: Colors.white, + // )), + // Padding( + // padding: EdgeInsets.all(6), + // child: AppText( + // TranslationBase.of(context).request, + // color: Colors.white, + // )), + // ], + // controller: _tabController, + // ), + // + // ), + // body: TabBarView( + // // physics: NeverScrollableScrollPhysics(), + // children: [myFamilyDetails(context), myFamilyRequest(context)], + // controller: _tabController), + // ); + // //bottomNavigationBar: BottomBarSearch()); - // AppScaffold( - // appBarTitle: TranslationBase.of(context).myFamilyFiles, - // isShowAppBar: true, - // body: SingleChildScrollView( - // child: Container( - // height: SizeConfig.screenHeight, - // width: SizeConfig.realScreenWidth, - // padding: EdgeInsets.all(20), - // child: Stack( - // children: [ - // TabBar( - // controller: _tabController, - // indicatorColor: Colors.red, - // tabs: [ - // Padding( - // padding: EdgeInsets.all(6), - // child: Text(TranslationBase.of(context).family)), - // Padding( - // padding: EdgeInsets.all(6), - // child: Text(TranslationBase.of(context).request)), - // ], - // ), - // TabBarView( - // controller: _tabController, - // children: [ - // myFamilyDetails(context), - // myFamilyRequest(context) - // ], - // ) - // ], - // )))); + return AppScaffold( + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: widget.isAppbarVisible, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight, + width: SizeConfig.realScreenWidth, + padding: EdgeInsets.all(20), + child: Stack( + children: [ + TabBar( + controller: _tabController, + indicatorColor: Colors.red, + tabs: [ + Padding( + padding: EdgeInsets.all(6), + child: Text(TranslationBase.of(context).family)), + Padding( + padding: EdgeInsets.all(6), + child: Text(TranslationBase.of(context).request)), + ], + ), + TabBarView( + controller: _tabController, + children: [ + myFamilyDetails(context), + myFamilyRequest(context) + ], + ) + ], + )))); } Widget myFamilyDetails(context) { @@ -219,12 +222,15 @@ class _MyFamily extends State with TickerProviderStateMixin { } Widget myFamilyRequest(context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: SingleChildScrollView( - child: Column( + return //Padding( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: + SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height, + margin: EdgeInsets.only(top:50), + child: Column( children: [ - // SizedBox(height: 20.0), RoundedContainer( child: ExpansionTile( title: Text( diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 9e11ee9a..3b6aee91 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; @@ -387,7 +388,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ), MedicalProfilePage(), BookingOptions(), - Container(), + MyFamily(isAppbarVisible:false), ToDo(), ], // Please do not remove the BookingOptions from this array ), From 0ed29be214d74ddd543f819f2143b274ab8acf0a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 19 Nov 2020 09:36:07 +0300 Subject: [PATCH 16/18] launch --- lib/widgets/drawer/app_drawer_widget.dart | 197 ++++++++++++---------- 1 file changed, 105 insertions(+), 92 deletions(-) diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index da20f144..aa3b4c60 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'dart:io'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../config/size_config.dart'; import '../../locator.dart'; @@ -98,7 +100,10 @@ class _AppDrawerState extends State { child: Column( children: [ AppText( - TranslationBase.of(context).fileno +": " + + TranslationBase.of( + context) + .fileno + + ": " + user.patientID .toString(), color: @@ -189,84 +194,87 @@ class _AppDrawerState extends State { width: 1.0, ), )), - child: Column(children: [ - user.isFamily == true ? Container( - - padding: EdgeInsets - .only( - bottom: - 5), - child: InkWell( - onTap: () { - switchUser( - mainUser, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment + child: Column( + children: [ + user.isFamily == true + ? Container( + padding: + EdgeInsets.only( + bottom: 5), + child: InkWell( + onTap: () { + switchUser( + mainUser, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + Expanded( + child: Icon( + Icons + .person), + ), + Expanded( + flex: 7, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText(mainUser.firstName + ' ' + mainUser.lastName), + AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()), + ])), + ], + ))) + : SizedBox(), + Column( + mainAxisAlignment: + MainAxisAlignment .start, - children: < - Widget>[ - Expanded( - child: Icon( - Icons.person), - ), - Expanded( - flex: - 7, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(mainUser.firstName +' '+mainUser.lastName), - AppText(TranslationBase.of(context).fileno +": " + mainUser.patientID.toString()), - ])), - ], - ))) : SizedBox(), - Column( - mainAxisAlignment: - MainAxisAlignment.start, - mainAxisSize: - MainAxisSize.min, - children: snapshot.data - .getAllSharedRecordsByStatusList - .map((result) { - return result.status == 3 - ? Container( - - padding: EdgeInsets - .only( - bottom: - 5), - child: InkWell( - onTap: () { - switchUser( - result, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Expanded( - child: Icon( - Icons.person, color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), - ), - Expanded( - flex: - 7, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(result.patientName, color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), - AppText(TranslationBase.of(context).fileno +": " + result.iD.toString(), color:result.responseID ==user.patientID ? Color(0xFF40ACC9): Colors.black), - ])), - ], - ))) - : SizedBox(); - }).toList())],)); + mainAxisSize: + MainAxisSize.min, + children: snapshot.data + .getAllSharedRecordsByStatusList + .map( + (result) { + return result + .status == + 3 + ? Container( + padding: EdgeInsets + .only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser( + result, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: < + Widget>[ + Expanded( + child: + Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ), + Expanded( + flex: 7, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ])), + ], + ))) + : SizedBox(); + }).toList()) + ], + )); } }, ), @@ -300,9 +308,13 @@ class _AppDrawerState extends State { TranslationBase.of(context).rateApp, Icons.star), onTap: () { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + if (Platform.isIOS) { + launch( + "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + } else { + launch( + "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + } }, ), InkWell( @@ -412,22 +424,23 @@ class _AppDrawerState extends State { } Future getFamilyFiles() async { - if(user !=null){ - if (await sharedPref.getObject(FAMILY_FILE) != null) { - // print(await sharedPref.getObject(FAMILY_FILE)); - return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( - await sharedPref.getObject(FAMILY_FILE))); - } else { - return familyFileProvider.getSharedRecordByStatus(); + if (user != null) { + if (await sharedPref.getObject(FAMILY_FILE) != null) { + // print(await sharedPref.getObject(FAMILY_FILE)); + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( + await sharedPref.getObject(FAMILY_FILE))); + } else { + return familyFileProvider.getSharedRecordByStatus(); + } } - } } switchUser(user, context) { Utils.showProgressDialog(context); this .familyFileProvider - .silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser) + .silentLoggin(user is AuthenticatedUser ? null : user, + mainUser: user is AuthenticatedUser) .then((value) => loginAfter(value, context)) .catchError((err) { print(err); @@ -443,10 +456,10 @@ class _AppDrawerState extends State { var familyFile = await sharedPref.getObject(FAMILY_FILE); var mainUser = await sharedPref.getObject(MAIN_USER); this.sharedPref.clear(); - if(mainUser["PatientID"] != result.list.patientID) { + if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } - this.sharedPref.setObject(MAIN_USER,mainUser); + this.sharedPref.setObject(MAIN_USER, mainUser); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); From 4c8c4e372587f5c0e5c32c25363669588d973e78 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 19 Nov 2020 18:05:54 +0300 Subject: [PATCH 17/18] setting page inprogress --- lib/services/permission/permission_service.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/services/permission/permission_service.dart diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart new file mode 100644 index 00000000..80eb19c5 --- /dev/null +++ b/lib/services/permission/permission_service.dart @@ -0,0 +1,16 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + +class PermissionService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + + +} From d2f391ab7f47d2f2957559d3f0b2044882e6ad3d Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 19 Nov 2020 18:06:16 +0300 Subject: [PATCH 18/18] setting page inprogress --- lib/pages/settings/general_setting.dart | 11 ++++++----- .../permission/permission_service.dart | 18 +++++++++++++++++- lib/widgets/buttons/button.dart | 6 ++++-- lib/widgets/buttons/defaultButton.dart | 5 ++++- pubspec.yaml | 1 + 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 5e174fbc..7fef62a5 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -24,7 +25,7 @@ class _GeneralSettings extends State bool camera =false; bool location =false; var sharedPref = new AppSharedPreferences(); - + var permission = new PermissionService(); @override void initState() { getValues(); @@ -256,16 +257,16 @@ class _GeneralSettings extends State } break; } - sharedPref.setInt(THEME_VALUE, value); + permission.setTheme(value); } setVibration(value){ - sharedPref.setBool(IS_VIBRATION, value); + permission.setVibrationPermission(value); } getValues() async{ - blindValue= await sharedPref.getInt(THEME_VALUE) ?? 0; - vibration= await sharedPref.getBool(IS_VIBRATION) ?? false; + blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled(); } getTheme(value) async{ if(value ==1){ diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index 80eb19c5..292724f2 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -6,11 +6,27 @@ import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; +import 'package:localstorage/localstorage.dart'; class PermissionService extends BaseService { - AppSharedPreferences sharedPref = AppSharedPreferences(); + final LocalStorage storage = new LocalStorage("permission"); + AppGlobal appGlobal = new AppGlobal(); + setVibrationPermission(flag) async { + storage.setItem('isVibration', flag); + } + + isVibrationEnabled() { + return storage.getItem('isVibration'); + } + + setTheme(flag) async { + storage.setItem('isTheme', flag); + } + isThemeEnabled() { + return storage.getItem('isTheme'); + } } diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index d37eb039..5b0e6489 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -1,4 +1,6 @@ +import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; /// Button widget @@ -33,7 +35,7 @@ class _ButtonState extends State