From 85062859c8f6f4ceceb9add6e8c1203c62745d4f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 25 Nov 2020 16:17:23 +0300 Subject: [PATCH 1/6] updates --- lib/pages/ToDoList/payment_method_select.dart | 78 +++++++++---------- lib/widgets/in_app_browser/InAppBrowser.dart | 16 ++-- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index a189128a..fe2a217b 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -163,45 +163,45 @@ class _PaymentMethodState extends State { ], ), ), - Container( - margin: EdgeInsets.only(top: 25.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("ApplePay"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "ApplePay" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(20.0), - child: SvgPicture.asset( - "assets/images/new-design/applepay.svg"), - ), - ), - ), - ), - ), - Expanded( - child: Container(), - ), - ], - ), - ), + // Container( + // margin: EdgeInsets.only(top: 25.0), + // child: Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // child: Container( + // child: InkWell( + // onTap: () { + // updateSelectedPaymentMethod("ApplePay"); + // }, + // child: Card( + // elevation: 3.0, + // margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + // color: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // side: selectedPaymentMethod == "ApplePay" + // ? BorderSide( + // color: Colors.green, width: 5.0) + // : BorderSide( + // color: Colors.transparent, width: 0.0), + // ), + // child: Container( + // height: 120.0, + // padding: EdgeInsets.all(20.0), + // child: SvgPicture.asset( + // "assets/images/new-design/applepay.svg"), + // ), + // ), + // ), + // ), + // ), + // Expanded( + // child: Container(), + // ), + // ], + // ), + // ), SizedBox( height: 150.0, ), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e465db39..c46b5616 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -10,17 +10,17 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; class MyInAppBrowser extends InAppBrowser { - static String SERVICE_URL = - 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = + // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT -// static String SERVICE_URL = -// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + // static String PREAUTH_SERVICE_URL = + // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT -// static String PREAUTH_SERVICE_URL = -// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static List successURLS = [ 'success', From e5feef8a9dbe477fcdb9e4c503a87546717dc0b4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 29 Nov 2020 12:17:46 +0300 Subject: [PATCH 2/6] Updates & UI Fixes --- lib/config/localized_values.dart | 8 +++++ lib/pages/BookAppointment/BookSuccess.dart | 2 +- .../MyAppointments/models/ArrivedButtons.dart | 32 +++++++++---------- .../widgets/AppointmentActions.dart | 14 ++++---- lib/pages/landing/home_page.dart | 2 +- .../medical/vital_sign/vital_sign_item.dart | 6 ++-- lib/uitl/translations_delegate_base.dart | 1 + .../medical/medical_profile_item.dart | 2 +- 8 files changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0ced0591..95ae6d74 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1035,5 +1035,13 @@ const Map localizedValues = { "en": "Email the Report", "ar": "أرسل التقرير" }, + "appoSurvey": { + "en": "Survey", + "ar": "إستبيان" + }, + "appoSurveySubtitle": { + "en": "Survey", + "ar": "إستبيان" + }, }; diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 82248560..92e6bc9e 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -554,7 +554,7 @@ class _BookSuccessState extends State { AppoitmentAllHistoryResultList appo) async { if (paymentMethod == "ApplePay") { await widget.chromeBrowser.open( - url: "https://flutter.dev/", + url: "https://applepay-datatrans-sample.herokuapp.com/", options: ChromeSafariBrowserClassOptions( android: AndroidChromeCustomTabsOptions( addDefaultShareMenuItem: false), diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index a89253c6..a30349ba 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -4,32 +4,32 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ArrivedButtons { static var buttons = [ { - "title": "Arrived", - "subtitle": "Status", + "title": TranslationBase.of(AppGlobal.context).arrived, + "subtitle": TranslationBase.of(AppGlobal.context).status, "icon": "assets/images/new-design/waiting-room.png", "caller": "openReschedule" }, { - "title": "Medicines", - "subtitle": "Prescriptions", + "title": TranslationBase.of(AppGlobal.context).medicines, + "subtitle": TranslationBase.of(AppGlobal.context).medicinesSubtitle, "icon": "assets/images/new-design/medicine_prescriptions_icon.png", "caller": "prescriptions" }, { - "title": "Radiology", - "subtitle": "Services", + "title": TranslationBase.of(AppGlobal.context).radiology, + "subtitle": TranslationBase.of(AppGlobal.context).radiologySubtitle, "icon": "assets/images/new-design/radiology_service_icon.png", "caller": "radiology" }, { - "title": "Lab", - "subtitle": "Result", + "title": TranslationBase.of(AppGlobal.context).lab, + "subtitle": TranslationBase.of(AppGlobal.context).labSubtitle, "icon": "assets/images/new-design/lab_result_icon.png", "caller": "labResult" }, { - "title": "Vital Signs", - "subtitle": "Values", + "title": TranslationBase.of(AppGlobal.context).vitalSigns, + "subtitle": TranslationBase.of(AppGlobal.context).vitalSignsSubtitle, "icon": "assets/images/new-design/vital_signs.png", "caller": "VitalSigns" }, @@ -40,20 +40,20 @@ class ArrivedButtons { "caller": "insertComplaint" }, { - "title": "Insurance", - "subtitle": "Approvals", + "title": TranslationBase.of(AppGlobal.context).insurance, + "subtitle": TranslationBase.of(AppGlobal.context).insuranceSubtitle, "icon": "assets/images/new-design/insurance_approvals_icon.png", "caller": "Insurance" }, { - "title": "Ask Your", - "subtitle": "Doctor", + "title": TranslationBase.of(AppGlobal.context).askYour, + "subtitle": TranslationBase.of(AppGlobal.context).askYourSubtitle, "icon": "assets/images/new-design/ask_doctor_icon.png", "caller": "askDoc" }, { - "title": "Survey", - "subtitle": "Service", + "title": TranslationBase.of(AppGlobal.context).appoSurvey, + "subtitle": TranslationBase.of(AppGlobal.context).service, "icon": "assets/images/new-design/survey.png", "caller": "Survey" } diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 7bb45bad..93069f1e 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -53,7 +53,7 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; - final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.455) / 2; final double itemWidth = size.width / 2; return Container( @@ -73,8 +73,8 @@ class _AppointmentActionsState extends State { _handleButtonClicks(e); }, child: Container( - height: 100.0, - margin: EdgeInsets.all(9.0), + // height: 100.0, + margin: EdgeInsets.all(7.0), decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -90,17 +90,17 @@ class _AppointmentActionsState extends State { children: [ Container( margin: - EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), child: Text(e.title, overflow: TextOverflow.clip, style: TextStyle( color: new Color(0xFF40ACC9), letterSpacing: 1.0, - fontSize: 20.0)), + fontSize: 18.0)), ), Container( margin: - EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), child: Text(e.subtitle, overflow: TextOverflow.clip, style: TextStyle( @@ -113,7 +113,7 @@ class _AppointmentActionsState extends State { margin: EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), child: Image.asset(e.icon, - width: 45.0, height: 45.0), + width: 40.0, height: 40.0), ), ], ), diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 6716535b..a98bb8eb 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -734,7 +734,7 @@ class _HomePageState extends State { ], ), ), - height: 100, + height: 106, imageName: 'rectangle.png', color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index fb44772d..fd3fdbdf 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -46,7 +46,7 @@ class VitalSignItem extends StatelessWidget { des, style: TextStyle( fontSize: 1.7 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), + color: Color(0xff40ACC9), fontWeight: FontWeight.bold, ), ), @@ -78,9 +78,9 @@ class VitalSignItem extends StatelessWidget { children: [ TextSpan(text: lastVal), TextSpan( - text: unit, + text: " " + unit, style: TextStyle( - color: HexColor('#B8382C'), + color: Color(0xff40ACC9), ), ), ]), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6e991e01..ab32218e 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -866,6 +866,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get report => localizedValues['report'][locale.languageCode]; String get openRad => localizedValues['open-rad'][locale.languageCode]; String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; + String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode]; } diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 6aadb3e0..8c14fb02 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -25,7 +25,7 @@ class MedicalProfileItem extends StatelessWidget { showBorder: true, borderWidth: 0, margin: 4, - height: 120, + // height: 120, // MediaQuery.of(context).size.height * 0.12, child: Container( //width: MediaQuery.of(context).size.width * 0.25, From e7c862c801084705ab5a98d3ae0178bc4593c894 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 30 Nov 2020 08:13:57 +0300 Subject: [PATCH 3/6] health weather indicator --- .../health-weather/health-weather-indicator.dart | 0 lib/widgets/slider/slider.dart | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart create mode 100644 lib/widgets/slider/slider.dart diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/widgets/slider/slider.dart b/lib/widgets/slider/slider.dart new file mode 100644 index 00000000..e69de29b From 648d9d245d1285f57a1260c3d86db1b1ffabf815 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 30 Nov 2020 08:14:07 +0300 Subject: [PATCH 4/6] health weather indicator --- lib/core/model/weahter/weather_model.dart | 266 ++++++++++++++++++ lib/core/service/weather_service.dart | 38 +++ .../weather/weather_view_model.dart | 31 ++ .../all_habib_medical_service_page.dart | 14 +- .../health-weather-indicator.dart | 106 +++++++ lib/routes.dart | 4 +- lib/widgets/slider/slider.dart | 0 .../weather_slider/weather_slider.dart | 55 ++++ 8 files changed, 511 insertions(+), 3 deletions(-) create mode 100644 lib/core/model/weahter/weather_model.dart create mode 100644 lib/core/service/weather_service.dart create mode 100644 lib/core/viewModels/weather/weather_view_model.dart delete mode 100644 lib/widgets/slider/slider.dart create mode 100644 lib/widgets/weather_slider/weather_slider.dart diff --git a/lib/core/model/weahter/weather_model.dart b/lib/core/model/weahter/weather_model.dart new file mode 100644 index 00000000..7ee84bac --- /dev/null +++ b/lib/core/model/weahter/weather_model.dart @@ -0,0 +1,266 @@ +class WeatherIndicatorModel { + Null date; + int languageID; + int serviceName; + Null time; + Null androidLink; + Null authenticationTokenID; + Null data; + bool dataw; + int dietType; + Null errorCode; + Null errorEndUserMessage; + Null errorEndUserMessageN; + Null errorMessage; + int errorType; + int foodCategory; + Null iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + Null patientBlodType; + Null successMsg; + Null successMsgN; + Null citiesList; + Null cityName; + Null get5DaysWeatherForecastList; + List getCityInfoList; + Null getTodayWeatherForecastList; + Null iniciesList; + + WeatherIndicatorModel( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.citiesList, + this.cityName, + this.get5DaysWeatherForecastList, + this.getCityInfoList, + this.getTodayWeatherForecastList, + this.iniciesList}); + + WeatherIndicatorModel.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + citiesList = json['CitiesList']; + cityName = json['CityName']; + get5DaysWeatherForecastList = json['Get5DaysWeatherForecastList']; + if (json['GetCityInfo_List'] != null) { + getCityInfoList = new List(); + json['GetCityInfo_List'].forEach((v) { + getCityInfoList.add(new GetCityInfoList.fromJson(v)); + }); + } + getTodayWeatherForecastList = json['GetTodayWeatherForecastList']; + iniciesList = json['IniciesList']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['CitiesList'] = this.citiesList; + data['CityName'] = this.cityName; + data['Get5DaysWeatherForecastList'] = this.get5DaysWeatherForecastList; + if (this.getCityInfoList != null) { + data['GetCityInfo_List'] = + this.getCityInfoList.map((v) => v.toJson()).toList(); + } + data['GetTodayWeatherForecastList'] = this.getTodayWeatherForecastList; + data['IniciesList'] = this.iniciesList; + return data; + } +} + +class GetCityInfoList { + CategoriesNames categoriesNames; + String category; + String categoryValue; + int cityID; + String cityName; + String cityNameN; + String colorName; + String createdOn; + String iD; + int iniceID; + bool isOrderEmpty; + bool isValuesReversed; + bool language; + double latitude; + double longitude; + String name; + int orderNum; + double temperature; + String value; + + GetCityInfoList( + {this.categoriesNames, + this.category, + this.categoryValue, + this.cityID, + this.cityName, + this.cityNameN, + this.colorName, + this.createdOn, + this.iD, + this.iniceID, + this.isOrderEmpty, + this.isValuesReversed, + this.language, + this.latitude, + this.longitude, + this.name, + this.orderNum, + this.temperature, + this.value}); + + GetCityInfoList.fromJson(Map json) { + categoriesNames = json['CategoriesNames'] != null + ? new CategoriesNames.fromJson(json['CategoriesNames']) + : null; + category = json['Category']; + categoryValue = json['CategoryValue']; + cityID = json['CityID']; + cityName = json['CityName']; + cityNameN = json['CityNameN']; + colorName = json['ColorName']; + createdOn = json['CreatedOn']; + iD = json['ID']; + iniceID = json['IniceID']; + isOrderEmpty = json['IsOrderEmpty']; + isValuesReversed = json['IsValuesReversed']; + language = json['Language']; + latitude = json['Latitude']; + longitude = json['Longitude']; + name = json['Name']; + orderNum = json['OrderNum']; + temperature = json['Temperature']; + value = json['Value']; + } + + Map toJson() { + final Map data = new Map(); + if (this.categoriesNames != null) { + data['CategoriesNames'] = this.categoriesNames.toJson(); + } + data['Category'] = this.category; + data['CategoryValue'] = this.categoryValue; + data['CityID'] = this.cityID; + data['CityName'] = this.cityName; + data['CityNameN'] = this.cityNameN; + data['ColorName'] = this.colorName; + data['CreatedOn'] = this.createdOn; + data['ID'] = this.iD; + data['IniceID'] = this.iniceID; + data['IsOrderEmpty'] = this.isOrderEmpty; + data['IsValuesReversed'] = this.isValuesReversed; + data['Language'] = this.language; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['Name'] = this.name; + data['OrderNum'] = this.orderNum; + data['Temperature'] = this.temperature; + data['Value'] = this.value; + return data; + } +} + +class CategoriesNames { + String category1; + String category2; + String category3; + String category4; + String category5; + + CategoriesNames( + {this.category1, + this.category2, + this.category3, + this.category4, + this.category5}); + + CategoriesNames.fromJson(Map json) { + category1 = json['Category1']; + category2 = json['Category2']; + category3 = json['Category3']; + category4 = json['Category4']; + category5 = json['Category5']; + } + + Map toJson() { + final Map data = new Map(); + data['Category1'] = this.category1; + data['Category2'] = this.category2; + data['Category3'] = this.category3; + data['Category4'] = this.category4; + data['Category5'] = this.category5; + return data; + } +} diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart new file mode 100644 index 00000000..828a665b --- /dev/null +++ b/lib/core/service/weather_service.dart @@ -0,0 +1,38 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class WeatherService extends BaseService { + List projectAvgERWaitingTimeModelList = List(); + + Map body = Map(); + String Latitude = ""; + String Longitude = ""; + String PhoneNumber = ""; + + Future getProjectAvgERWaitingTimeOrders() async { + hasError = false; + + var lat = await sharedPref.getDouble(USER_LAT); + var long = await sharedPref.getDouble(USER_LONG); + body['Latitude'] = lat ?? 0; + body['Longitude'] = long ?? 0; + + await baseAppClient.post(GET_NEAREST_HOSPITAL, + onSuccess: (dynamic response, int statusCode) { + response['List_ProjectAvgERWaitingTime'].forEach((vital) { + projectAvgERWaitingTimeModelList + .add(ProjectAvgERWaitingTime.fromJson(vital)); + }); + projectAvgERWaitingTimeModelList.forEach((element) { + Latitude = '${element.latitude}'; + Longitude = '${element.longitude}'; + PhoneNumber = '${element.phoneNumber}'; + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/weather/weather_view_model.dart b/lib/core/viewModels/weather/weather_view_model.dart new file mode 100644 index 00000000..eb00db9b --- /dev/null +++ b/lib/core/viewModels/weather/weather_view_model.dart @@ -0,0 +1,31 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; + +import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; + +import '../../../locator.dart'; + +class WeatherViewModel extends BaseViewModel { + ErService _erService = locator(); + + List get ProjectAvgERWaitingTimeModeList => + _erService.projectAvgERWaitingTimeModelList; + + getProjectAvgERWaitingTimeOrders({int id, int projectID}) async { + setState(ViewState.Busy); + + if (id != null && projectID != null) { + await _erService.getProjectAvgERWaitingTimeOrders( + id: id, projectID: projectID); + } else { + await _erService.getProjectAvgERWaitingTimeOrders(); + } + if (_erService.hasError) { + error = _erService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 7e3d4181..d46a357c 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20hea import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; @@ -98,7 +99,16 @@ class _AllHabibMedicalServiceState extends State { ], ), Expanded( - child: Column( + child:InkWell( + onTap: (){ + Navigator.push( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Image.asset('assets/images/Weather_ico.png',width: 80,height: 80,), @@ -108,7 +118,7 @@ class _AllHabibMedicalServiceState extends State { decoration: TextDecoration.underline, ), ], - ), + )), ) ], ), diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index e69de29b..aa384a66 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -0,0 +1,106 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; +import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/slider/slider.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_xlider/flutter_xlider.dart'; +import 'package:giffy_dialog/giffy_dialog.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:maps_launcher/maps_launcher.dart'; + +class HealthWeatherIndicator extends StatefulWidget { + + + @override + _HospitalsPageState createState() => _HospitalsPageState(); +} + +class _HospitalsPageState extends State { + LinearGradient gradient = LinearGradient( + colors: [ + Colors.red, + Colors.orange, + Colors.yellow, + Colors.green, + Colors.blue, + Colors.blue[900], + Colors.purple + ] + ); + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).healthWeatherIndicators, + isShowAppBar: true, + body: SingleChildScrollView( + child: Column(children: [ + WeatherSlider(.4, LinearGradient(colors: [Colors.redAccent[100],Colors.redAccent ])), + WeatherSlider(.6, LinearGradient(colors: [Colors.greenAccent[100],Colors.greenAccent ])), + WeatherSlider(.8, LinearGradient(colors: [Colors.yellowAccent[100],Colors.yellowAccent ])), + ]) + ), + ); + } +} + + +class WeatherSlider extends StatelessWidget{ + final width; + final LinearGradient color; + WeatherSlider(this.width, this.color); + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText('Low', fontSize: 24,), + + Padding( + padding: EdgeInsets.all(10), + child: + Stack( + children: [ + Container( + decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100],Colors.grey[400] ]), + borderRadius: BorderRadius.circular(10) + ), + height: 15, width: MediaQuery.of(context).size.width, + child:SizedBox(), + ), + Positioned( + top:0, + child: Container( + decoration: BoxDecoration(gradient: color, + borderRadius: BorderRadius.circular(10) + ), + height: 15, + width: MediaQuery.of(context).size.width * width, + padding: EdgeInsets.all(10), + child:SizedBox(), + + )), + + ], + )), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText('Low', fontSize: 12,), + AppText('Moderate', fontSize: 12,), + AppText('High', fontSize: 12,), + AppText('Very High', fontSize: 12,), + AppText('Extreme', fontSize: 12,), + ],) + ],); + + } +} \ No newline at end of file diff --git a/lib/routes.dart b/lib/routes.dart index b11025c2..74a6a189 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family-member.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family_type.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; @@ -52,5 +53,6 @@ var routes = { SYMPTOM_CHECKER: (_) => SymptomChecker(), SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), - SETTINGS: (_) => Settings() + SETTINGS: (_) => Settings(), + HEALTH_WEATHER: (_)=> HealthWeatherIndicator() }; diff --git a/lib/widgets/slider/slider.dart b/lib/widgets/slider/slider.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart new file mode 100644 index 00000000..8eafab4c --- /dev/null +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -0,0 +1,55 @@ + + +class WeatherSlider extends StatelessWidget{ + final width; + final LinearGradient color; + WeatherSlider(this.width, this.color); + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('Low', fontSize: 24,), + + Padding( + padding: EdgeInsets.all(10), + child: + Stack( + children: [ + Container( + decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100],Colors.grey[400] ]), + borderRadius: BorderRadius.circular(10) + ), + height: 15, width: MediaQuery.of(context).size.width, + child:SizedBox(), + ), + Positioned( + top:0, + child: Container( + decoration: BoxDecoration(gradient: color, + borderRadius: BorderRadius.circular(10) + ), + height: 15, + width: MediaQuery.of(context).size.width * width, + padding: EdgeInsets.all(10), + child:SizedBox(), + + )), + + ], + )), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText('Low', fontSize: 12,), + AppText('Moderate', fontSize: 12,), + AppText('High', fontSize: 12,), + AppText('Very High', fontSize: 12,), + AppText('Extreme', fontSize: 12,), + ],) + ],); + + } +} \ No newline at end of file From 7d3c1ac852f5acd530ad1ab763c862c2b24cf4dc Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 1 Dec 2020 15:30:38 +0300 Subject: [PATCH 5/6] weather indicator updated --- lib/config/config.dart | 9 +- lib/config/shared_pref_kay.dart | 3 +- lib/core/service/weather_service.dart | 23 +- .../weather/weather_view_model.dart | 28 +-- lib/locator.dart | 6 +- .../all_habib_medical_service_page.dart | 100 ++++---- .../health-weather-indicator.dart | 126 +++------- lib/routes.dart | 1 + .../weather_slider/weather_slider.dart | 224 ++++++++++++++---- 9 files changed, 314 insertions(+), 206 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 37da28b4..2cd553fa 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,11 +6,13 @@ 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://uat.hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; +//weather +const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; + ///Doctor const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; @@ -256,8 +258,7 @@ const GET_PAtIENTS_INSURANCE = const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; -const INSURANCE_DETAILS = - "Services/Patients.svc/REST/Get_InsuranceCheckList"; +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"; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index ac611c71..bcd7195b 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -18,4 +18,5 @@ const IS_SEARCH_APPO = 'is-search-appo'; const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; const IS_VIBRATION = 'is_vibration'; const THEME_VALUE = 'is_vibration'; -const MAIN_USER = 'main-user'; \ No newline at end of file +const MAIN_USER = 'main-user'; +const WEATHER = 'weather'; \ No newline at end of file diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart index 828a665b..b2dcf0ef 100644 --- a/lib/core/service/weather_service.dart +++ b/lib/core/service/weather_service.dart @@ -1,17 +1,17 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class WeatherService extends BaseService { - List projectAvgERWaitingTimeModelList = List(); + List weatherIndicatorData = List(); Map body = Map(); String Latitude = ""; String Longitude = ""; String PhoneNumber = ""; - Future getProjectAvgERWaitingTimeOrders() async { + Future getWeatherData() async { hasError = false; var lat = await sharedPref.getDouble(USER_LAT); @@ -19,20 +19,19 @@ class WeatherService extends BaseService { body['Latitude'] = lat ?? 0; body['Longitude'] = long ?? 0; - await baseAppClient.post(GET_NEAREST_HOSPITAL, + await baseAppClient.post(WEATHER_INDICATOR, onSuccess: (dynamic response, int statusCode) { - response['List_ProjectAvgERWaitingTime'].forEach((vital) { - projectAvgERWaitingTimeModelList - .add(ProjectAvgERWaitingTime.fromJson(vital)); - }); - projectAvgERWaitingTimeModelList.forEach((element) { - Latitude = '${element.latitude}'; - Longitude = '${element.longitude}'; - PhoneNumber = '${element.phoneNumber}'; + + + response['GetCityInfo_List'].forEach((data) { + weatherIndicatorData.add(GetCityInfoList.fromJson(data)); }); + print(weatherIndicatorData); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); + await this.sharedPref.setObject(WEATHER,weatherIndicatorData[0]); } } diff --git a/lib/core/viewModels/weather/weather_view_model.dart b/lib/core/viewModels/weather/weather_view_model.dart index eb00db9b..85b019e4 100644 --- a/lib/core/viewModels/weather/weather_view_model.dart +++ b/lib/core/viewModels/weather/weather_view_model.dart @@ -1,29 +1,29 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import '../../../locator.dart'; class WeatherViewModel extends BaseViewModel { - ErService _erService = locator(); - - List get ProjectAvgERWaitingTimeModeList => - _erService.projectAvgERWaitingTimeModelList; - - getProjectAvgERWaitingTimeOrders({int id, int projectID}) async { + WeatherService _weatherService = locator(); + List get weatherIndicatorData => + _weatherService.weatherIndicatorData; + getWeatherData({int id, int projectID}) async { setState(ViewState.Busy); - if (id != null && projectID != null) { - await _erService.getProjectAvgERWaitingTimeOrders( - id: id, projectID: projectID); - } else { - await _erService.getProjectAvgERWaitingTimeOrders(); - } - if (_erService.hasError) { - error = _erService.error; + // if (id != null && projectID != null) { + // await _erService.getProjectAvgERWaitingTimeOrders( + // id: id, projectID: projectID); + // } else { + await _weatherService.getWeatherData(); + // } + if (_weatherService.hasError) { + error = _weatherService.error; setState(ViewState.Error); } else setState(ViewState.Idle); diff --git a/lib/locator.dart b/lib/locator.dart index d13d4057..310558f2 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:get_it/get_it.dart'; @@ -132,7 +134,7 @@ void setupLocator() { locator.registerLazySingleton(() => DeleteBabyService()); locator.registerLazySingleton(() => VaccinationTableService()); locator.registerLazySingleton(() => NotificationService()); - + locator.registerLazySingleton(() => WeatherService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -152,6 +154,7 @@ void setupLocator() { locator.registerFactory(() => QrViewModel()); locator.registerFactory(() => ReportsMonthlyViewModel()); locator.registerFactory(() => NearHospitalViewModel()); + locator.registerFactory(() => WeatherViewModel()); locator.registerFactory(() => AmRequestViewModel()); locator.registerFactory(() => PatientSickLeaveViewMode()); locator.registerFactory(() => MyBalanceViewModel()); @@ -175,5 +178,4 @@ void setupLocator() { locator.registerFactory(() => HomeHealthCareViewModel()); locator.registerFactory(() => CMCViewModel()); locator.registerFactory(() => NotificationViewModel()); - } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index d46a357c..5deac2f2 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -22,10 +22,12 @@ import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/services)contaniner.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -44,11 +46,13 @@ class AllHabibMedicalService extends StatefulWidget { class _AllHabibMedicalServiceState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser = new AuthenticatedUser(); - + LocationUtils locationUtils; + var weather ='--'; @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { getAuthUser(); + locationUtils.getCurrentLocation(); }); super.initState(); } @@ -77,28 +81,33 @@ class _AllHabibMedicalServiceState extends State { fit: BoxFit.cover, ), borderRadius: BorderRadius.circular(8.0)), + child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Row( children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .healthWeatherIndicators, - color: Colors.white, - fontWeight: FontWeight.w600, - ), - Texts( - TranslationBase.of(context).healthTipsBasedOnCurrentWeather, - color: Colors.white, - fontSize: 14, - ), - ], - ), Expanded( + flex:3, + child: + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .healthWeatherIndicators, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + Texts( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + color: Colors.white, + fontSize: 14, + ), + ], + )), + Expanded( + flex: 2, child:InkWell( onTap: (){ Navigator.push( @@ -109,16 +118,22 @@ class _AllHabibMedicalServiceState extends State { ); }, child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Image.asset('assets/images/Weather_ico.png',width: 80,height: 80,), - Texts( - TranslationBase.of(context).moreDetails, - color: Colors.white, - decoration: TextDecoration.underline, - ), - ], - )), + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/images/Weather_ico.png',width: 60,height: 60,), + AppText(weather, fontSize: 22, color:Colors.white) + ],), + + Texts( + TranslationBase.of(context).moreDetails, + color: Colors.white, + decoration: TextDecoration.underline, + ), + ], + )), ) ], ), @@ -130,7 +145,7 @@ class _AllHabibMedicalServiceState extends State { widget.goToMyProfile(); }, imageLocation: - 'assets/images/new-design/my_file_bottom_bar.png', + 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), @@ -144,7 +159,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: - 'assets/images/new-design/booking_icon_active.png', + 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), ServicesContainer( @@ -155,7 +170,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: - 'assets/images/al-habib_online_payment_service_icon.png', + 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), @@ -182,7 +197,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: - 'assets/images/new-design/family_menu_icon_red.png', + 'assets/images/new-design/family_menu_icon_red.png', title: 'My Family', ), @@ -194,7 +209,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: - 'assets/images/new-design/upcoming_icon_bottom_bar.png', + 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), @@ -206,27 +221,27 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: - 'assets/images/new-design/parking_system_icon.png', + 'assets/images/new-design/parking_system_icon.png', title: TranslationBase.of(context).parking, ), ServicesContainer( onTap: () => launch( "https://hmgwebservices.com/vt_mobile/html/index.html"), imageLocation: - 'assets/images/new-design/virtual_tour_icon.png', + 'assets/images/new-design/virtual_tour_icon.png', title: 'Virtual Tour', ), ServicesContainer( onTap: () { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( - title: "HMG News", - selectedUrl: - "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", - ))); + title: "HMG News", + selectedUrl: + "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + ))); }, imageLocation: - 'assets/images/new-design/twitter_dashboard_icon.png', + 'assets/images/new-design/twitter_dashboard_icon.png', title: 'Latest News', ), ServicesContainer( @@ -248,13 +263,16 @@ class _AllHabibMedicalServiceState extends State { } getAuthUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); - print(authUser.patientID); } + var data = await this.sharedPref.getObject(WEATHER); + weather = data['Temperature'].toString() + '\u2103' ?? '--'; + print(data); } } diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index aa384a66..98aba205 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -1,106 +1,56 @@ -import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; -import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/slider/slider.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_xlider/flutter_xlider.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:provider/provider.dart'; class HealthWeatherIndicator extends StatefulWidget { - - @override _HospitalsPageState createState() => _HospitalsPageState(); } + class _HospitalsPageState extends State { - LinearGradient gradient = LinearGradient( - colors: [ - Colors.red, - Colors.orange, - Colors.yellow, - Colors.green, - Colors.blue, - Colors.blue[900], - Colors.purple - ] - ); + var data; + LocationUtils locationUtils; + @override + void initState() { + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + + super.initState(); + } @override Widget build(BuildContext context) { - return AppScaffold( - isShowDecPage: false, - appBarTitle: TranslationBase.of(context).healthWeatherIndicators, - isShowAppBar: true, - body: SingleChildScrollView( - child: Column(children: [ - WeatherSlider(.4, LinearGradient(colors: [Colors.redAccent[100],Colors.redAccent ])), - WeatherSlider(.6, LinearGradient(colors: [Colors.greenAccent[100],Colors.greenAccent ])), - WeatherSlider(.8, LinearGradient(colors: [Colors.yellowAccent[100],Colors.yellowAccent ])), - ]) - ), + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getWeatherData(), + builder: (_, mode, widget) => AppScaffold( + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).healthWeatherIndicators, + isShowAppBar: true, + baseViewModel: mode, + body: mode.weatherIndicatorData.length>0 ? SingleChildScrollView( + child: Column(children: [ + Padding(padding: EdgeInsets.all(15), child:AppText( projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, fontSize: 24, fontWeight: FontWeight.bold,)), + Padding( + padding: EdgeInsets.all(15), + child: Column(children: + mode.weatherIndicatorData + .map((data) { + return WeatherSlider( + data); + }).toList() + + ))])) : Container(child:AppText('Loading...'))), ); } } - - -class WeatherSlider extends StatelessWidget{ - final width; - final LinearGradient color; - WeatherSlider(this.width, this.color); - - @override - Widget build(BuildContext context) { - // TODO: implement build - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText('Low', fontSize: 24,), - - Padding( - padding: EdgeInsets.all(10), - child: - Stack( - children: [ - Container( - decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100],Colors.grey[400] ]), - borderRadius: BorderRadius.circular(10) - ), - height: 15, width: MediaQuery.of(context).size.width, - child:SizedBox(), - ), - Positioned( - top:0, - child: Container( - decoration: BoxDecoration(gradient: color, - borderRadius: BorderRadius.circular(10) - ), - height: 15, - width: MediaQuery.of(context).size.width * width, - padding: EdgeInsets.all(10), - child:SizedBox(), - - )), - - ], - )), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Low', fontSize: 12,), - AppText('Moderate', fontSize: 12,), - AppText('High', fontSize: 12,), - AppText('Very High', fontSize: 12,), - AppText('Extreme', fontSize: 12,), - ],) - ],); - - } -} \ No newline at end of file diff --git a/lib/routes.dart b/lib/routes.dart index 74a6a189..dc49ce18 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -36,6 +36,7 @@ const String SYMPTOM_CHECKER = 'symptom-checker'; const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info'; const String SELECT_GENDER = 'select-gender'; const String SETTINGS = 'settings'; +const String HEALTH_WEATHER = 'health-weather'; var routes = { SPLASH: (_) => SplashScreen(), HOME: (_) => LandingPage(), diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart index 8eafab4c..61d5c1d5 100644 --- a/lib/widgets/weather_slider/weather_slider.dart +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -1,55 +1,191 @@ +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; - -class WeatherSlider extends StatelessWidget{ - final width; - final LinearGradient color; - WeatherSlider(this.width, this.color); - +class WeatherSlider extends StatelessWidget { + // final width; + // final LinearGradient color; + final GetCityInfoList data; + WeatherSlider(this.data); + LinearGradient red = LinearGradient( + colors: [ + Colors.redAccent[100], + Colors.redAccent + ]); + LinearGradient green = LinearGradient( + colors: [ + Colors.greenAccent[100], + Colors.greenAccent + ]); + LinearGradient grey = LinearGradient( + colors: [ + Colors.grey[100], + Colors.grey + ]); + LinearGradient orange = LinearGradient( + colors: [ + Colors.orangeAccent[100], + Colors.orange + ]); + LinearGradient yellow = LinearGradient( + colors: [ + Colors.yellow[100], + Colors.yellow[600] + ]); @override Widget build(BuildContext context) { // TODO: implement build return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText('Low', fontSize: 24,), - - Padding( - padding: EdgeInsets.all(10), - child: - Stack( - children: [ - Container( - decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100],Colors.grey[400] ]), - borderRadius: BorderRadius.circular(10) + Padding( + padding: EdgeInsets.only(top:10), + child: AppText(data.name)), + AppText( + data.category, + fontSize: 24, + ), + Padding( + padding: EdgeInsets.all(10), + child: Stack( + children: [ + Container( + margin: EdgeInsets.only(bottom:10), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.grey[100], Colors.grey[400]]), + borderRadius: BorderRadius.circular(10)), + height: 15, + width: MediaQuery.of(context).size.width, + child: SizedBox(), + ), + Positioned( + top: 0, + child: Container( + decoration: BoxDecoration( + gradient: data.colorName =='red' ? red : data.colorName =='orange' ? orange : data.colorName =='green' ? green : data.colorName == 'yellow' ? yellow : grey, + borderRadius: BorderRadius.circular(10)), + height: 15, + width: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + padding: EdgeInsets.all(15), + child: SizedBox(), + )), + Positioned(child: Container( + height: 0, + width:0, + decoration: ShapeDecoration( + color:data.colorName =='red' ? Colors.redAccent : data.colorName =='orange' ? Colors.orangeAccent : data.colorName =='green' ? Colors.greenAccent : data.colorName == 'yellow' ? Colors.yellowAccent : Colors.grey, + shape: MessageBorder(), + + )),top:25, left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)),) + + ], + ), + + ), + Padding( + padding: EdgeInsets.only(top:10), + child: data.isValuesReversed == false ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + ), + AppText( + data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + ], + ) : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + ), + AppText( + data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + + ), + AppText( + data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black + ), - height: 15, width: MediaQuery.of(context).size.width, - child:SizedBox(), - ), - Positioned( - top:0, - child: Container( - decoration: BoxDecoration(gradient: color, - borderRadius: BorderRadius.circular(10) - ), - height: 15, - width: MediaQuery.of(context).size.width * width, - padding: EdgeInsets.all(10), - child:SizedBox(), - - )), - - ], - )), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText('Low', fontSize: 12,), - AppText('Moderate', fontSize: 12,), - AppText('High', fontSize: 12,), - AppText('Very High', fontSize: 12,), - AppText('Extreme', fontSize: 12,), - ],) - ],); + ], + )), + Padding( + padding: EdgeInsets.all(15), + child:Divider()) + ], + ); } +} +class MessageBorder extends ShapeBorder { + final bool usePadding; + + MessageBorder({this.usePadding = true}); + + @override + EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding? 0 : 0); + + @override + Path getInnerPath(Rect rect, {TextDirection textDirection}) => null; + + @override + Path getOuterPath(Rect rect, {TextDirection textDirection}) { + rect = Rect.fromPoints(rect.bottomRight, rect.bottomLeft - Offset(0, 0)); + return Path() + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..moveTo(rect.topCenter.dx - 10, rect.topCenter.dy) + ..relativeLineTo(10, -10) + ..relativeLineTo(10,10) + ..close(); + } + + @override + void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) {} + + @override + ShapeBorder scale(double t) => this; } \ No newline at end of file From 078183c1fbfbd8db8c996511b848474bb88109f8 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 1 Dec 2020 16:23:40 +0300 Subject: [PATCH 6/6] not authenticated page updated --- lib/widgets/others/not_auh_page.dart | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index a1a2f00c..d1684125 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/routes.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'; @@ -8,6 +10,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../splashPage.dart'; + class NotAutPage extends StatelessWidget { final String title; final String description; @@ -99,8 +103,9 @@ class NotAutPage extends StatelessWidget { Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - onTap: () => Navigator.pushReplacement( - context, FadePage(page: LoginType())), + onTap: (){ + loginCheck(context); + }, label: TranslationBase.of(context).serviceInformationButton, textColor: Theme.of(context).backgroundColor), ), @@ -109,4 +114,16 @@ class NotAutPage extends StatelessWidget { ), ); } + + loginCheck(context) async{ + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + } }