diff --git a/lib/config/config.dart b/lib/config/config.dart index cea61bdb..b8a0efbf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -11,6 +11,9 @@ const MAX_SMALL_SCREEN = 660; 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'; @@ -258,8 +261,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/localized_values.dart b/lib/config/localized_values.dart index 2ffe8f1b..d4fb4c19 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1072,4 +1072,9 @@ const Map localizedValues = { "ar": "أقل من المتوسط" }, + "info-signs": { + "en": "This service allows you to view all vital signs were performed in the Habib Medical Group, e.x (height, weight, body mass index, heart rate, etc.) as well shows some statistics charts.", + "ar": "خدمة المؤشرات الحيوية: هذه الخدمة تمكنك من الاطلاع على جميع المؤشرات الحيوية على سبيل المثال (الطول، الوزن، مؤشر كتلة الجسم، معدل نبضات القلب الخ..) التي تمت في مجموعة الحبيب الطبية وكذلك رسوم بيانية على مستوى المؤشر." + }, + }; 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/model/ImagesInfo.dart b/lib/core/model/ImagesInfo.dart new file mode 100644 index 00000000..5ab48fb3 --- /dev/null +++ b/lib/core/model/ImagesInfo.dart @@ -0,0 +1,6 @@ +class ImagesInfo { + final String imageAr; + final String imageEn; + + ImagesInfo({this.imageAr, this.imageEn}); +} 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..b2dcf0ef --- /dev/null +++ b/lib/core/service/weather_service.dart @@ -0,0 +1,37 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class WeatherService extends BaseService { + List weatherIndicatorData = List(); + + Map body = Map(); + String Latitude = ""; + String Longitude = ""; + String PhoneNumber = ""; + + Future getWeatherData() 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(WEATHER_INDICATOR, + onSuccess: (dynamic response, int statusCode) { + + + 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 new file mode 100644 index 00000000..85b019e4 --- /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/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 { + 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 _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 7e3d4181..5deac2f2 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'; @@ -21,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'; @@ -43,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(); } @@ -76,39 +81,59 @@ 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( - 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, - ), - ], - ), + 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( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Column( + 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, + ), + ], + )), ) ], ), @@ -120,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, ), @@ -134,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( @@ -145,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, ), @@ -172,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', ), @@ -184,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, ), @@ -196,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( @@ -238,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 new file mode 100644 index 00000000..98aba205 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -0,0 +1,56 @@ +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/others/app_scaffold_widget.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:provider/provider.dart'; + +class HealthWeatherIndicator extends StatefulWidget { + @override + _HospitalsPageState createState() => _HospitalsPageState(); +} + + +class _HospitalsPageState extends State { + 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) { + 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...'))), + ); + } +} diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index 667620a2..c4273a09 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/vital_sign_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item.dart'; @@ -17,9 +18,13 @@ class VitalSignDetailsScreen extends StatelessWidget { int appointmentNo; int projectID; VitalSignDetailsScreen({this.appointmentNo, this.projectID}); + List imagesInfo = List(); + @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png')); return BaseView( onModelReady: appointmentNo != null && projectID != null ? (model) => model.getPatientRadOrders( @@ -29,6 +34,8 @@ class VitalSignDetailsScreen extends StatelessWidget { isShowAppBar: true, appBarTitle: TranslationBase.of(context).vitalSigns, baseViewModel: mode, + description: TranslationBase.of(context).infoSigns, + imagesInfo: imagesInfo, body: mode.vitalSignResModelList.length > 0 ? Container( child: ListView( diff --git a/lib/routes.dart b/lib/routes.dart index b11025c2..dc49ce18 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'; @@ -35,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(), @@ -52,5 +54,6 @@ var routes = { SYMPTOM_CHECKER: (_) => SymptomChecker(), SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), - SETTINGS: (_) => Settings() + SETTINGS: (_) => Settings(), + HEALTH_WEATHER: (_)=> HealthWeatherIndicator() }; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b94c3953..6f133ed3 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -873,6 +873,9 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get v_good => localizedValues['v-good'][locale.languageCode]; String get excellent => localizedValues['excellent'][locale.languageCode]; String get below_average => localizedValues['below-average'][locale.languageCode]; + String get infoSigns => localizedValues['info-signs'][locale.languageCode]; + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index a807b02e..d0372bfc 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -40,6 +41,7 @@ class AppScaffold extends StatelessWidget { final String image; final bool isShowDecPage; final List infoList; + final List imagesInfo; AuthenticatedUserObject authenticatedUserObject = locator(); @@ -57,7 +59,7 @@ class AppScaffold extends StatelessWidget { this.isShowDecPage = true, this.isBottomBar, this.image, - this.infoList}); + this.infoList, this.imagesInfo}); @override Widget build(BuildContext context) { @@ -125,6 +127,7 @@ class AppScaffold extends StatelessWidget { title: appBarTitle, description: description, infoList: infoList, + imagesInfo: imagesInfo, ) : baseViewModel != null ? NetworkBaseView( diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index a1a2f00c..e3fc1802 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -1,5 +1,9 @@ +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.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,12 +12,24 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class NotAutPage extends StatelessWidget { +import '../../splashPage.dart'; + +class NotAutPage extends StatefulWidget { final String title; final String description; final List infoList; + final List imagesInfo; + + NotAutPage({@required this.title, @required this.description, this.infoList, this.imagesInfo}); + + @override + _NotAutPageState createState() => _NotAutPageState(); +} + +class _NotAutPageState extends State { + + int _current = 0; - NotAutPage({@required this.title, @required this.description, this.infoList}); @override Widget build(BuildContext context) { @@ -25,7 +41,7 @@ class NotAutPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - title ?? 'Service', + widget.title ?? 'Service', fontWeight: FontWeight.w800, fontSize: 25, bold: true, @@ -36,17 +52,17 @@ class NotAutPage extends StatelessWidget { height: 12, ), Texts( - description ?? 'Description', + widget.description ?? 'Description', fontWeight: FontWeight.normal, fontSize: 17, ), - if (infoList != null) + if (widget.infoList != null) SizedBox( height: 12, ), - if (infoList != null) + if (widget.infoList != null) ...List.generate( - infoList.length, + widget.infoList.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -65,7 +81,7 @@ class NotAutPage extends StatelessWidget { ), ), SizedBox(width: 6,), - Expanded(child: Texts('${infoList[index]}')) + Expanded(child: Texts('${widget.infoList[index]}')) ], ), SizedBox(height: 12,), @@ -76,6 +92,7 @@ class NotAutPage extends StatelessWidget { SizedBox( height: 22, ), + if(!projectViewModel.isInternetConnection) Center( child: SizedBox( height: MediaQuery.of(context).size.height * 0.55, @@ -85,6 +102,24 @@ class NotAutPage extends StatelessWidget { : 'assets/images/wifi-EN.png'), ), ), + if(projectViewModel.isInternetConnection && widget.imagesInfo!=null) + CarouselSlider( + items: widget.imagesInfo.map((image) { + return Builder( + builder: (BuildContext context){ + return SizedBox( + width: MediaQuery.of(context).size.width * 0.50, + child: Image.network(projectViewModel.isArabic ? image.imageAr : image.imageEn)); + }, + ); + }).toList(), + options: CarouselOptions( + height: MediaQuery.of(context).size.height * 0.55, + autoPlay: true, + viewportFraction: 1.0, + ), + ), + SizedBox( height: 77, ), @@ -99,8 +134,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 +145,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, + ); + } + } } diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart new file mode 100644 index 00000000..61d5c1d5 --- /dev/null +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -0,0 +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; + 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: [ + 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 + + ), + ], + )), + 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