From 895c09efa4e5f4a8c3d0e92296384eb7ed1e379b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 31 Aug 2020 14:38:53 +0300 Subject: [PATCH] parking service --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 12 +- lib/config/shared_pref_kay.dart | 1 + lib/core/model/qr/qr_parking_model.dart | 172 ++++++++++++++ lib/core/service/pharmacies_service.dart | 4 +- lib/core/service/qr_service.dart | 21 ++ lib/core/viewModels/qr_view_model.dart | 55 +++++ lib/locator.dart | 4 + lib/main.dart | 3 + .../all_habib_medical_service_page.dart | 51 +++++ .../AlHabibMedicalService/parking_page.dart | 211 ++++++++++++++++++ lib/pages/landing/home_page.dart | 36 ++- lib/uitl/translations_delegate_base.dart | 11 + lib/widgets/others/app_scaffold_widget.dart | 13 +- lib/widgets/others/arrow_back.dart | 9 +- 15 files changed, 585 insertions(+), 20 deletions(-) create mode 100644 lib/core/model/qr/qr_parking_model.dart create mode 100644 lib/core/service/qr_service.dart create mode 100644 lib/core/viewModels/qr_view_model.dart create mode 100644 lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart create mode 100644 lib/pages/AlHabibMedicalService/parking_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 55b44a34..81814468 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -53,6 +53,8 @@ const INSERT_REQUEST_FOR_MEDICAL_REPORT = '/Doctors.svc/REST/InsertRequestForMed const IS_LAST_APPOITMENT_RATED = '/Doctors.svc/REST/IsLastAppoitmentRated'; const GET_APPOINTMENT_DETAILS_BY_NO = '/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; +///Qr +const GET_QR_PARKING = '/SWP.svc/REST/GetQRParkingByID'; //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment //const BASE_URL = 'https://hmgwebservices.com/Services'; // Production Environment diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c8f59a84..3005c123 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -335,6 +335,16 @@ const Map> localizedValues = { "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, - "logs": {"en": "Logs", "ar": "السجلات"} + "logs": {"en": "Logs", "ar": "السجلات"}, + "parking":{"en":"Parking","ar":"مواقف"}, + "alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, + "parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, + "readBarcode":{"en":"Read Barcode","ar":"قراءة الكود"}, + "showMyPark":{"en":"Show My Park","ar":"عرض بارك"}, + "clearMyData":{"en":"clear My Data","ar":"امسح البيانات"}, + "floor":{"en":"Floor:","ar":"الطابق"}, + "gate":{"en":"Gate:","ar":"بوابة"}, + "building":{"en":"Building:","ar":"المبنى"}, + "branch":{"en":"Branch:","ar":"الفرع"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 53fa08dd..c71334e9 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -10,3 +10,4 @@ const ONLY_SMS = 'only-sms'; const AUTH_DATA = 'auth-data'; const IMEI_USER_DATA = 'imei-user-data'; const NHIC_DATA = 'nhic-data'; +const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; diff --git a/lib/core/model/qr/qr_parking_model.dart b/lib/core/model/qr/qr_parking_model.dart new file mode 100644 index 00000000..1df927bc --- /dev/null +++ b/lib/core/model/qr/qr_parking_model.dart @@ -0,0 +1,172 @@ +class QRParkingModel { + Null totalRecords; + Null nRowID; + int qRParkingID; + String description; + String descriptionN; + Null qRCompare; + Null qRValue; + String imagePath; + bool isActive; + int parkingID; + int branchID; + int companyID; + int buildingID; + int rowID; + int gateID; + int floorID; + Null imagePath1; + int createdBy; + String createdOn; + Null editedBy; + Null editedOn; + String parkingDescription; + String parkingDescriptionN; + String gateDescription; + String gateDescriptionN; + String branchDescription; + String branchDescriptionN; + String companyDescription; + String companyDescriptionN; + String rowDescription; + String rowDescriptionN; + String floorDescription; + String floorDescriptionN; + String buildingDescription; + String buildingDescriptionN; + String qRParkingCode; + String parkingCode; + double latitude; + double longitude; + String qRImageStr; + + QRParkingModel( + {this.totalRecords, + this.nRowID, + this.qRParkingID, + this.description, + this.descriptionN, + this.qRCompare, + this.qRValue, + this.imagePath, + this.isActive, + this.parkingID, + this.branchID, + this.companyID, + this.buildingID, + this.rowID, + this.gateID, + this.floorID, + this.imagePath1, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.parkingDescription, + this.parkingDescriptionN, + this.gateDescription, + this.gateDescriptionN, + this.branchDescription, + this.branchDescriptionN, + this.companyDescription, + this.companyDescriptionN, + this.rowDescription, + this.rowDescriptionN, + this.floorDescription, + this.floorDescriptionN, + this.buildingDescription, + this.buildingDescriptionN, + this.qRParkingCode, + this.parkingCode, + this.latitude, + this.longitude, + this.qRImageStr}); + + QRParkingModel.fromJson(Map json) { + totalRecords = json['TotalRecords']; + nRowID = json['nRowID']; + qRParkingID = json['QRParkingID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + qRCompare = json['QRCompare']; + qRValue = json['QRValue']; + imagePath = json['ImagePath']; + isActive = json['IsActive']; + parkingID = json['ParkingID']; + branchID = json['BranchID']; + companyID = json['CompanyID']; + buildingID = json['BuildingID']; + rowID = json['RowID']; + gateID = json['GateID']; + floorID = json['FloorID']; + imagePath1 = json['ImagePath1']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + parkingDescription = json['ParkingDescription']; + parkingDescriptionN = json['ParkingDescriptionN']; + gateDescription = json['GateDescription']; + gateDescriptionN = json['GateDescriptionN']; + branchDescription = json['BranchDescription']; + branchDescriptionN = json['BranchDescriptionN']; + companyDescription = json['CompanyDescription']; + companyDescriptionN = json['CompanyDescriptionN']; + rowDescription = json['RowDescription']; + rowDescriptionN = json['RowDescriptionN']; + floorDescription = json['FloorDescription']; + floorDescriptionN = json['FloorDescriptionN']; + buildingDescription = json['BuildingDescription']; + buildingDescriptionN = json['BuildingDescriptionN']; + qRParkingCode = json['QRParkingCode']; + parkingCode = json['ParkingCode']; + latitude = json['Latitude']; + longitude = json['Longitude']; + qRImageStr = json['QRImageStr']; + } + + Map toJson() { + final Map data = new Map(); + data['TotalRecords'] = this.totalRecords; + data['nRowID'] = this.nRowID; + data['QRParkingID'] = this.qRParkingID; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['QRCompare'] = this.qRCompare; + data['QRValue'] = this.qRValue; + data['ImagePath'] = this.imagePath; + data['IsActive'] = this.isActive; + data['ParkingID'] = this.parkingID; + data['BranchID'] = this.branchID; + data['CompanyID'] = this.companyID; + data['BuildingID'] = this.buildingID; + data['RowID'] = this.rowID; + data['GateID'] = this.gateID; + data['FloorID'] = this.floorID; + data['ImagePath1'] = this.imagePath1; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['ParkingDescription'] = this.parkingDescription; + data['ParkingDescriptionN'] = this.parkingDescriptionN; + data['GateDescription'] = this.gateDescription; + data['GateDescriptionN'] = this.gateDescriptionN; + data['BranchDescription'] = this.branchDescription; + data['BranchDescriptionN'] = this.branchDescriptionN; + data['CompanyDescription'] = this.companyDescription; + data['CompanyDescriptionN'] = this.companyDescriptionN; + data['RowDescription'] = this.rowDescription; + data['RowDescriptionN'] = this.rowDescriptionN; + data['FloorDescription'] = this.floorDescription; + data['FloorDescriptionN'] = this.floorDescriptionN; + data['BuildingDescription'] = this.buildingDescription; + data['BuildingDescriptionN'] = this.buildingDescriptionN; + data['QRParkingCode'] = this.qRParkingCode; + data['ParkingCode'] = this.parkingCode; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['QRImageStr'] = this.qRImageStr; + return data; + } +} diff --git a/lib/core/service/pharmacies_service.dart b/lib/core/service/pharmacies_service.dart index b155d4d0..f89fb425 100644 --- a/lib/core/service/pharmacies_service.dart +++ b/lib/core/service/pharmacies_service.dart @@ -70,8 +70,8 @@ class PharmacyService extends BaseService { _medicineItem.add(PharmaciesModel.fromJson(item)); }); }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; + hasError = true; + super.error = error; }, body: _requestGetPharmaciesModel.toJson()); } catch (error) { throw error; diff --git a/lib/core/service/qr_service.dart b/lib/core/service/qr_service.dart new file mode 100644 index 00000000..d43ed5bb --- /dev/null +++ b/lib/core/service/qr_service.dart @@ -0,0 +1,21 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/qr/qr_parking_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class QrService extends BaseService { + List qRParkingList = List(); + + Future getQRParkingByID(int qRParkingID) async { + Map body = Map(); + body['QRParkingID'] = qRParkingID; + await baseAppClient.post(GET_QR_PARKING, + onSuccess: (dynamic response, int statusCode) { + response['List_SWP_QRParkingModel'].forEach((item) { + qRParkingList.add(QRParkingModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/qr_view_model.dart b/lib/core/viewModels/qr_view_model.dart new file mode 100644 index 00000000..cc03d9ab --- /dev/null +++ b/lib/core/viewModels/qr_view_model.dart @@ -0,0 +1,55 @@ +import 'dart:convert'; + +import 'package:barcode_scan/platform_wrapper.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/qr/qr_parking_model.dart'; +import 'package:diplomaticquarterapp/core/service/qr_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import '../../locator.dart'; + +class QrViewModel extends BaseViewModel { + QrService _qrService = locator(); + bool isSavePark = false; + QRParkingModel qrParkingModel; + + readQr() async { + var result = await BarcodeScanner.scan(); + var data = json.decode(result.rawContent); + var qRParkingID = data['QRParkingID']; + setState(ViewState.BusyLocal); + await _qrService.getQRParkingByID(qRParkingID); + if (_qrService.hasError) { + error = _qrService.error; + setState(ViewState.ErrorLocal); + } else { + if (_qrService.qRParkingList.length > 0) { + qrParkingModel = _qrService.qRParkingList[0]; + await sharedPref.setObject(IS_GO_TO_PARKING, qrParkingModel); + isSavePark = true; + setState(ViewState.Idle); + } else { + error = "Invalid Qr Code"; + setState(ViewState.ErrorLocal); + } + } + } + + getIsSaveParking() async { + setState(ViewState.Busy); + var parking = await sharedPref.getObject(IS_GO_TO_PARKING); + if (parking != null) { + isSavePark = true; + qrParkingModel = QRParkingModel.fromJson(parking); + } + setState(ViewState.Busy); + } + + clearParking() async { + setState(ViewState.Busy); + await sharedPref.setObject(IS_GO_TO_PARKING, null); + isSavePark = false; + qrParkingModel = null; + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 66face42..be35b5ab 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/service/qr_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:get_it/get_it.dart'; @@ -27,6 +28,7 @@ import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; import 'core/service/insurance_service.dart'; import 'core/viewModels/insurance_card_View_model.dart'; +import 'core/viewModels/qr_view_model.dart'; GetIt locator = GetIt.instance; @@ -47,6 +49,7 @@ void setupLocator() { locator.registerLazySingleton(() => ReportsService()); locator.registerLazySingleton(() => DashboardService()); locator.registerLazySingleton(() => AppointmentRateService()); + locator.registerLazySingleton(() => QrService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -62,5 +65,6 @@ void setupLocator() { locator.registerFactory(() => MedicalViewModel()); locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => AppointmentRateViewModel()); + locator.registerFactory(() => QrViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index ca2e7a82..268f8ba2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -66,6 +66,9 @@ class MyApp extends StatelessWidget { highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Colors.grey, + bottomSheetTheme:BottomSheetThemeData( + backgroundColor: Hexcolor('#E0E0E0') + ) , cursorColor: Color.fromRGBO(78, 62, 253, 1.0), iconTheme: IconThemeData(), appBarTheme: AppBarTheme( diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart new file mode 100644 index 00000000..dc0d3cd2 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AllHabibMedicalService extends StatefulWidget { + @override + _AllHabibMedicalServiceState createState() => _AllHabibMedicalServiceState(); +} + +class _AllHabibMedicalServiceState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).alhabiServices, + body: ListView( + children: [ + InkWell( + onTap: ()=> Navigator.push(context, FadePage(page: ParkingPage())), + child: Container( + height: 50, + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).parking, + fontSize: 16, + ) + ], + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart new file mode 100644 index 00000000..9610ad35 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -0,0 +1,211 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/qr_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; + +class ParkingPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getIsSaveParking(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).parking, + body: SingleChildScrollView( + padding: EdgeInsets.all(12), + child: !model.isSavePark + ? Column( + children: [ + Texts( + TranslationBase.of(context).parkingTitle, + fontWeight: FontWeight.normal, + fontSize: 15, + ), + SizedBox( + height: 12, + ), + Image.asset( + 'assets/images/timeline_bg.png', + width: double.infinity, + ) + ], + ) + : Column( + children: [ + Row( + children: [ + Expanded( + child: Image.asset( + 'assets/images/timeline_bg.png', + height: 150, + fit: BoxFit.cover, + )), + SizedBox( + width: 15, + ), + Expanded( + child: Container( + height: 150, + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Texts(model.qrParkingModel.parkingDescriptionN), + Divider( + height: 3, + ), + Texts(model.qrParkingModel.rowDescriptionN) + ], + ), + ), + ), + ], + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(8), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle), + height: 70, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).showMyPark), + Texts(model.qrParkingModel.floorDescriptionN), + ], + ), + ), + SizedBox( + height: 15, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle), + padding: EdgeInsets.all(8), + width: double.infinity, + height: 70, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).gate), + Texts(model.qrParkingModel.gateDescriptionN), + ], + ), + ), + SizedBox( + height: 15, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle), + padding: EdgeInsets.all(8), + width: double.infinity, + height: 70, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).building), + Texts(model.qrParkingModel.buildingDescriptionN), + ], + ), + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle), + width: double.infinity, + height: 70, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).branch), + Texts(model.qrParkingModel.branchDescriptionN), + ], + ), + ), + SizedBox( + height: 15, + ), + ], + ), + ), + bottomSheet: !model.isSavePark + ? Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + onTap: () async { + model.readQr(); + }, + label: TranslationBase.of(context).readBarcode, + loading: model.state == ViewState.BusyLocal, + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + ) + : Container( + height: MediaQuery.of(context).size.height * 0.15, + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + onTap: () async { + MapsLauncher.launchCoordinates( + model.qrParkingModel.latitude, + model.qrParkingModel.longitude, + ); + }, + disabled: model.qrParkingModel.longitude == 0, + label: TranslationBase.of(context).showMyPark, + textColor: Theme.of(context).backgroundColor), + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => model.clearParking(), + child: Texts( + TranslationBase.of(context).clearMyData, + color: Colors.red, + decoration: TextDecoration.underline, + )) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index ad1bb32c..fe44e112 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -51,7 +52,8 @@ class _HomePageState extends State { children: [ Expanded( child: InkWell( - onTap: ()=>Navigator.push(context, FadePage(page: LiveCareHome())), + onTap: () => Navigator.push(context, + FadePage(page: LiveCareHome())), child: Container( height: 110, margin: EdgeInsets.all(5), @@ -59,7 +61,12 @@ class _HomePageState extends State { color: Colors.transparent .withOpacity(0.3), ), - child: Center(child: Texts('Live care ',color: Colors.white,),), + child: Center( + child: Texts( + 'Live care ', + color: Colors.white, + ), + ), ), ), ), @@ -130,7 +137,9 @@ class _HomePageState extends State { fontSize: 16, ), Align( - alignment: projectViewModel.isArabic? Alignment.bottomLeft: Alignment.bottomRight, + alignment: projectViewModel.isArabic + ? Alignment.bottomLeft + : Alignment.bottomRight, child: InkWell( onTap: () {}, child: Container( @@ -182,7 +191,8 @@ class _HomePageState extends State { height: 15, ), Texts( - TranslationBase.of(context).homeHealthCareService, + TranslationBase.of(context) + .homeHealthCareService, textAlign: TextAlign.center, color: Colors.white, bold: true, @@ -215,7 +225,6 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.white, bold: true, - ) ], ), @@ -280,7 +289,8 @@ class _HomePageState extends State { height: 15, ), Texts( - TranslationBase.of(context).onlinePaymentService, + TranslationBase.of(context) + .onlinePaymentService, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -343,7 +353,8 @@ class _HomePageState extends State { height: 15, ), Texts( - TranslationBase.of(context).comprehensiveMedicalCheckup, + TranslationBase.of(context) + .comprehensiveMedicalCheckup, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -382,9 +393,9 @@ class _HomePageState extends State { color: Colors.white, fontWeight: FontWeight.normal, ), - Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -392,9 +403,9 @@ class _HomePageState extends State { Expanded( child: Container(), ), - Text( + Texts( TranslationBase.of(context).viewMore, - //color: Colors.white, + color: Colors.white, //fontWeight: FontWeight.normal, ) ], @@ -405,6 +416,8 @@ class _HomePageState extends State { opacity: 0.5, color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, + onTap: () => Navigator.push( + context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( child: Container( @@ -418,7 +431,6 @@ class _HomePageState extends State { color: Colors.white, fontWeight: FontWeight.normal, ), - Texts( TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 13681a86..cd8178e3 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -420,6 +420,17 @@ class TranslationBase { String get contactUs =>localizedValues['ContactUs'][locale.languageCode]; String get viewAllWaysReachUs =>localizedValues['ViewAllWaysReachUs'][locale.languageCode]; String get medicalProfile =>localizedValues['medicalProfile'][locale.languageCode]; + String get parking =>localizedValues['parking'][locale.languageCode]; + String get alhabiServices =>localizedValues['alhabiServices'][locale.languageCode]; + String get parkingTitle =>localizedValues['parkingTitle'][locale.languageCode]; + String get readBarcode =>localizedValues['readBarcode'][locale.languageCode]; + String get showMyPark =>localizedValues['showMyPark'][locale.languageCode]; + String get clearMyData =>localizedValues['clearMyData'][locale.languageCode]; + String get floor =>localizedValues['floor'][locale.languageCode]; + String get gate =>localizedValues['gate'][locale.languageCode]; + String get building =>localizedValues['building'][locale.languageCode]; + String get branch =>localizedValues['branch'][locale.languageCode]; + String get consultation => diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 3e86397a..c0f7262f 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,8 +1,12 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; import '../progress_indicator/app_loader_widget.dart'; import 'arrow_back.dart'; @@ -50,9 +54,10 @@ class AppScaffold extends StatelessWidget { IconButton( icon: Icon(FontAwesomeIcons.home), color: Colors.white, - onPressed: () { - // TODO add navigator to home page - }, + onPressed: () => Navigator.pushReplacement( + context, + FadePage(page: LandingPage()), + ), ), ], ) @@ -72,6 +77,6 @@ class AppScaffold extends StatelessWidget { } buildBodyWidget() { - return Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return body ;//Stack(children: [body, buildAppLoaderWidget(isLoading)]); } } diff --git a/lib/widgets/others/arrow_back.dart b/lib/widgets/others/arrow_back.dart index d22b5c17..498554fd 100644 --- a/lib/widgets/others/arrow_back.dart +++ b/lib/widgets/others/arrow_back.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class ArrowBack extends StatelessWidget { final Function onTap; @@ -8,12 +10,17 @@ class ArrowBack extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return GestureDetector( behavior: HitTestBehavior.opaque, onTap: Feedback.wrapForTap(() { onTap != null ? onTap() : Navigator.pop(context); }, context), - child: Icon(EvaIcons.arrowBack, color: Theme.of(context).primaryColor), + child: Icon( + projectViewModel.isArabic + ? Icons.arrow_back_ios + : Icons.arrow_forward_ios, + color: Theme.of(context).primaryColor), ); } }