From f77d2b497eba583f0c399ea8b8d72169cabe3c3f Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 6 Jan 2021 12:58:02 +0200 Subject: [PATCH] fix issues --- help/test/widget_test.dart | 4 +- ios/Podfile.lock | 14 +- lib/config/config.dart | 7 +- lib/core/model/privilege/PrivilegeModel.dart | 24 + lib/core/model/weahter/weather_model.dart | 267 ++++++ .../service/medical/my_balance_service.dart | 17 +- lib/core/service/privilege_service.dart | 22 + .../medical/my_balance_view_model.dart | 4 +- lib/core/viewModels/project_view_model.dart | 64 +- .../weather/weather_view_model.dart | 31 + lib/pages/landing/home_page.dart | 872 ++++++++++-------- lib/pages/landing/landing_page.dart | 403 ++++---- .../medical/balance/advance_payment_page.dart | 2 + lib/pages/medical/medical_profile_page.dart | 456 ++------- .../vital_sing_chart_and_detials.dart | 2 +- lib/uitl/LocalNotification.dart | 7 +- lib/uitl/utils.dart | 359 +++++++ .../weather_slider/weather_slider.dart | 191 ++++ pubspec.yaml | 2 - 19 files changed, 1728 insertions(+), 1020 deletions(-) create mode 100644 lib/core/model/privilege/PrivilegeModel.dart create mode 100644 lib/core/model/weahter/weather_model.dart create mode 100644 lib/core/service/privilege_service.dart create mode 100644 lib/core/viewModels/weather/weather_view_model.dart create mode 100644 lib/widgets/weather_slider/weather_slider.dart diff --git a/help/test/widget_test.dart b/help/test/widget_test.dart index 0d8435b7..9ca1523f 100644 --- a/help/test/widget_test.dart +++ b/help/test/widget_test.dart @@ -8,7 +8,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:help/main.dart'; +import '../lib/main.dart'; + + void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d65de659..a09481c1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -173,6 +173,10 @@ PODS: - Flutter - url_launcher_windows (0.0.1): - Flutter + - vibration (1.7.3): + - Flutter + - vibration_web (1.6.2): + - Flutter - video_player (0.0.1): - Flutter - video_player_web (0.0.1): @@ -233,6 +237,8 @@ DEPENDENCIES: - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) + - vibration (from `.symlinks/plugins/vibration/ios`) + - vibration_web (from `.symlinks/plugins/vibration_web/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) - video_player_web (from `.symlinks/plugins/video_player_web/ios`) - wakelock (from `.symlinks/plugins/wakelock/ios`) @@ -355,6 +361,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/url_launcher_web/ios" url_launcher_windows: :path: ".symlinks/plugins/url_launcher_windows/ios" + vibration: + :path: ".symlinks/plugins/vibration/ios" + vibration_web: + :path: ".symlinks/plugins/vibration_web/ios" video_player: :path: ".symlinks/plugins/video_player/ios" video_player_web: @@ -432,6 +442,8 @@ SPEC CHECKSUMS: url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 + vibration: b5a33e764c3f609a975b9dca73dce20fdde627dc + vibration_web: 0ba303d92469ba34d71c612a228b315908d7fcd9 video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 @@ -440,4 +452,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 5a17be3f8af73a757fa4439c77cf6ab2db29a6e7 -COCOAPODS: 1.8.4 +COCOAPODS: 1.10.0 diff --git a/lib/config/config.dart b/lib/config/config.dart index a0c7f6a7..4183fe68 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,10 +12,10 @@ const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/exacartapi'; const PACKAGES_CATEGORIES = '/api/categories'; const PACKAGES_PRODUCTS = '/api/products'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; -const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Geofencing @@ -24,6 +24,9 @@ const LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo'; //weather const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; +const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; + + ///Doctor const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; diff --git a/lib/core/model/privilege/PrivilegeModel.dart b/lib/core/model/privilege/PrivilegeModel.dart new file mode 100644 index 00000000..3b629fde --- /dev/null +++ b/lib/core/model/privilege/PrivilegeModel.dart @@ -0,0 +1,24 @@ +class PrivilegeModel { + int iD; + String serviceName; + bool privilege; + dynamic region; + + PrivilegeModel({this.iD, this.serviceName, this.privilege, this.region}); + + PrivilegeModel.fromJson(Map json) { + iD = json['ID']; + serviceName = json['ServiceName']; + privilege = json['Previlege']; + region = json['Region']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ServiceName'] = this.serviceName; + data['Previlege'] = this.privilege; + data['Region'] = this.region; + return data; + } +} diff --git a/lib/core/model/weahter/weather_model.dart b/lib/core/model/weahter/weather_model.dart new file mode 100644 index 00000000..37ee5983 --- /dev/null +++ b/lib/core/model/weahter/weather_model.dart @@ -0,0 +1,267 @@ +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/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart index 7f3747ee..86e925b8 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -24,7 +24,8 @@ class MyBalanceService extends BaseService { String logInTokenID; String verificationCode; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); MyBalanceService(){ getFamilyFiles(); @@ -65,13 +66,14 @@ class MyBalanceService extends BaseService { }, body: body); } - getPatientInfoByPatientIDAndMobileNumber() async { + getPatientInfoByPatientIDAndMobileNumber(AdvanceModel advanceModel) async { hasError = false; super.error = ""; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['MobileNo'] = authenticatedUserObject.user.mobileNumber; - body['ProjectID'] = authenticatedUserObject.user.projectID; + body['MobileNo'] = advanceModel.mobileNumber; + body['ProjectID'] = advanceModel.hospitalsModel.iD; + body['PatientID'] = advanceModel.fileNumber; await baseAppClient.post(GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER, onSuccess: (response, statusCode) async { @@ -85,7 +87,7 @@ class MyBalanceService extends BaseService { }, body: body); } - sendActivationCodeForAdvancePayment({int patientID,int projectID}) async { + sendActivationCodeForAdvancePayment({int patientID, int projectID}) async { hasError = false; super.error = ""; Map body = Map(); @@ -115,9 +117,8 @@ class MyBalanceService extends BaseService { body['LogInTokenID'] = logInTokenID; await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT, - onSuccess: (response, statusCode) async { - - }, onFailure: (String error, int statusCode) { + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { hasError = true; super.error = error; super.error = error; diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart new file mode 100644 index 00000000..5beef992 --- /dev/null +++ b/lib/core/service/privilege_service.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PrivilegeService extends BaseService { + + List privilegeModelList = List(); + + Future getPrivilege() async { + Map body = Map(); + body['PatientType'] = 4; + await baseAppClient.post(GET_PRIVILEGE, + onSuccess: (dynamic response, int statusCode) { + response['ServicePrivilegeList'].forEach((item) { + privilegeModelList.add(PrivilegeModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index 8c79f0f0..f9554d94 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -108,10 +108,10 @@ class MyBalanceViewModel extends BaseViewModel { } } - Future getPatientInfoByPatientIDAndMobileNumber() async { + Future getPatientInfoByPatientIDAndMobileNumber(AdvanceModel advanceModel) async { setState(ViewState.Busy); await _myBalanceService - .getPatientInfoByPatientIDAndMobileNumber(); + .getPatientInfoByPatientIDAndMobileNumber(advanceModel); if (_myBalanceService.hasError) { error = _myBalanceService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index a7aa6097..baaf6b5b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'package:connectivity/connectivity.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; @@ -24,9 +26,7 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; - bool isLogin - = false; - + bool isLogin = false; dynamic get searchValue => searchvalue; @@ -36,14 +36,21 @@ class ProjectViewModel extends BaseViewModel { bool get isArabic => _isArabic; - // BaseViewModel baseViewModel = locator() + + bool isLoginChild = false; + List privilegeRootUser = List(); + List privilegeChildUser = List(); + + List get privileges => + isLoginChild ? privilegeChildUser : privilegeChildUser; + StreamSubscription subscription; ProjectViewModel() { - // PlatformBridge.init(context); // Moved to 'main.dart' due to context availability loadSharedPrefLanguage(); - - subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { + subscription = Connectivity() + .onConnectivityChanged + .listen((ConnectivityResult result) { switch (result) { case ConnectivityResult.wifi: isInternetConnection = true; @@ -82,6 +89,49 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setPrivilegeModelList( + {List privilege}) { + this.isLoginChild = isLoginChild; + privilegeRootUser = privilege; + + notifyListeners(); + } + + setPrivilege({privilegeList, bool isLoginChild = false}) { + List privilege = List(); + + privilegeList['List'][0]['ListPrivilege'].forEach((item) { + privilege.add(PrivilegeModel.fromJson(item)); + }); + + this.isLoginChild = isLoginChild; + if (isLoginChild) + privilegeChildUser = privilege; + else + privilegeRootUser = privilege; + + notifyListeners(); + } + + setIsLoginChild({@required bool isLoginChild}){ + this.isLoginChild = isLoginChild; + notifyListeners(); + } + + bool havePrivilege(int id) { + bool isHavePrivilege = false; + if(isLoginChild) + privilegeChildUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + else{ + privilegeRootUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + } + return isHavePrivilege; + } + @override void dispose() { if (subscription != null) subscription.cancel(); 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..bb201843 --- /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() 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/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 5c260384..3d49d707 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,12 +1,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/geofencing/requests/LogGeoZoneRequestModel.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; -import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; @@ -17,12 +11,9 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/offers_packages/offers_packages.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -31,10 +22,6 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; -import '../../widgets/data_display/medical/LabResult/LineChartCurved.dart'; -import '../../locator.dart'; - class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -45,15 +32,9 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - ToDoCountProviderModel toDoProvider; - - AuthenticatedUserObject authenticatedUserObject = - locator(); - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - toDoProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( @@ -72,7 +53,10 @@ class _HomePageState extends State { width: double.infinity, height: 210, decoration: BoxDecoration( - image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/dashboard_top_bg.png'), + fit: BoxFit.cover), ), child: Stack( children: [ @@ -81,7 +65,8 @@ class _HomePageState extends State { left: 5, right: 5, child: Container( - width: MediaQuery.of(context).size.width * 0.8, + width: + MediaQuery.of(context).size.width * 0.8, child: Row( children: [ Expanded( @@ -91,42 +76,81 @@ class _HomePageState extends State { margin: EdgeInsets.all(5), decoration: BoxDecoration( image: DecorationImage( - image: AssetImage("assets/images/new-design/covid_bg_transparent.png"), + image: AssetImage( + "assets/images/new-design/covid_bg_transparent.png"), fit: BoxFit.fill, ), - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(5))), + color: + Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), child: Container( margin: EdgeInsets.only(top: 10.0), child: Column( children: [ - Text("COVID-19 TEST", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18.0)), + Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: + FontWeight.bold, + fontSize: 18.0)), Row( children: [ Container( - margin: EdgeInsets.only(top: 15.0, left: 3.5, right: 3.5), - child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0), + margin: EdgeInsets.only( + top: 15.0, left: 3.5, right: 3.5), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 45.0, + height: 45.0), ), Container( - margin: EdgeInsets.only(left: 10.0, top: 10.0), + margin: EdgeInsets.only( + left: 10.0, + top: 10.0), child: Column( children: [ - Text("Drive-Thru", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16.0)), + Text("Drive-Thru", + style: TextStyle( + color: Colors + .white, + fontWeight: + FontWeight + .bold, + fontSize: + 16.0)), ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0), + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 5.0), ), - minWidth: MediaQuery.of(context).size.width * 0.15, + minWidth: MediaQuery.of( + context) + .size + .width * + 0.15, height: 25.0, child: RaisedButton( - color: Colors.red[800], - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), + color: Colors + .red[800], + textColor: + Colors.white, + disabledTextColor: + Colors.white, + disabledColor: + new Color( + 0xFFbcc2c4), onPressed: () { navigateToCovidDriveThru(); }, - child: Text("BOOK NOW", style: TextStyle(fontSize: 12.0)), + child: Text( + "BOOK NOW", + style: TextStyle( + fontSize: + 12.0)), ), ), ], @@ -141,14 +165,21 @@ class _HomePageState extends State { ), Expanded( child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), + onTap: () => Navigator.push(context, + FadePage(page: LiveCareHome())), child: Container( height: 120, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), - decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))), + decoration: BoxDecoration( + color: Colors.white + .withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), child: SvgPicture.asset( - projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg', + projectViewModel.isArabic + ? 'assets/images/new-design/livecare_arabic_logo.svg' + : 'assets/images/new-design/liveCare_white_logo.svg', ), ), ), @@ -159,339 +190,374 @@ class _HomePageState extends State { ) ], ), - ), Container(width: double.infinity, height: 80) ], ), Positioned( top: 155, - left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), - right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), + left: MediaQuery.of(context).size.width * + (MediaQuery.of(context).orientation == + Orientation.landscape + ? 0.02 + : 0.03), + right: MediaQuery.of(context).size.width * + (MediaQuery.of(context).orientation == + Orientation.landscape + ? 0.02 + : 0.03), child: (!model.isLogin && projectViewModel.user == null) ? Container( - width: double.infinity, - height: 125, - decoration: BoxDecoration( - color: HexColor('#A59E9E'), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(9)), - image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts( - TranslationBase.of(context).myMedicalFile, - color: Colors.black87, - bold: true, - fontSize: 23, - ), - SizedBox( - height: 5, + width: double.infinity, + height: 125, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(9)), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/bg_graphic.png'), + fit: BoxFit.cover)), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.black87, + bold: true, + fontSize: 23, + ), + SizedBox( + height: 5, + ), + Texts( + TranslationBase.of(context) + .myMedicalFileSubTitle, + color: Colors.black, + fontSize: 16, + ), + Align( + alignment: projectViewModel.isArabic + ? Alignment.bottomRight + : Alignment.bottomLeft, + child: InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(9)), ), - Texts( - TranslationBase.of(context).myMedicalFileSubTitle, - color: Colors.black, - fontSize: 16, + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontSize: 12, + ), ), - Align( - alignment: projectViewModel.isArabic ? Alignment.bottomRight : Alignment.bottomLeft, - child: InkWell( - onTap: () { - widget.goToMyProfile(); - }, - child: Container( - margin: EdgeInsets.all(2), - width: 90, - height: 30, - decoration: BoxDecoration( - color: HexColor('#D81A2E'), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(9)), + ), + ), + ) + ], + ), + ), + ) + : Container( + width: double.infinity, + height: 130, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(9)), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/bg_graphic.png'), + fit: BoxFit.cover), + ), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + Row( + children: [ + if (model.user != null) + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, ), - child: Center( - child: Texts( - TranslationBase.of(context).viewMore, - color: Colors.white, - fontSize: 12, - ), + Texts( + model.user.firstName + + " " + + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + Texts( + '${model.user.patientID}', + color: Colors.white, + fontSize: 14, + ), + SizedBox( + height: 5, ), + Texts( + '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', + color: Colors.grey[100], + fontWeight: FontWeight.normal, + fontSize: 14, + ), + ], + ), + ), + InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(5), ), ), - ) - ], - ), - ), - ) - : Container( - width: double.infinity, - height: 130, - decoration: BoxDecoration( - color: HexColor('#A59E9E'), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(9)), - image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover), + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], ), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - children: [ - Row( + Row( + //crossAxisAlignment: CrossAxisAlignment.center, + //mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - if (model.user != null) - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts( - model.user.firstName + " " + model.user.lastName, - color: Colors.grey[100], - bold: true, - fontSize: 15, - ), - Texts( - '${model.user.patientID}', - color: Colors.white, - fontSize: 14, - ), - SizedBox( - height: 5, - ), - Texts( - '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', - color: Colors.grey[100], - fontWeight: FontWeight.normal, - fontSize: 14, - ), - ], - ), - ), - InkWell( - onTap: () { - widget.goToMyProfile(); - }, - child: Container( - margin: EdgeInsets.all(2), - width: 90, - height: 30, - decoration: BoxDecoration( - color: HexColor('#D81A2E'), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(5), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).viewMore, - color: Colors.white, - fontSize: 12, - ), - ), - ), + Image.asset( + 'assets/images/height_icon.png', + width: 35, + height: 40, + ), + Texts( + "${model.heightCm}", + color: Colors.white, ) ], ), - Row( - //crossAxisAlignment: CrossAxisAlignment.center, - //mainAxisAlignment: MainAxisAlignment.spaceAround, + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/height_icon.png', - width: 35, - height: 40, - ), - Texts( - "${model.heightCm}", - color: Colors.white, - ) - ], - ), - ), - SizedBox( - width: 3, + Image.asset( + 'assets/images/weight_icon.png', + width: 25, + height: 40, ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/weight_icon.png', - width: 25, - height: 40, - ), - Texts( - '${model.weightKg}', - color: Colors.white, - ) - ], - ), - ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/blood_icon.png', - width: 35, - height: 40, - ), - Texts( - '${model.bloadType}', - color: Colors.white, - ) - ], - ), + Texts( + '${model.weightKg}', + color: Colors.white, + ) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/blood_icon.png', + width: 35, + height: 40, ), + Texts( + '${model.booldType}', + color: Colors.white, + ) ], - ) - ], - ), - ), - ), + ), + ), + ], + ) + ], + ), + ), + ), ), ], ), - - /* Zohiab Kambrani | Commented below because its in progress - OffersAndPackagesWidget(OfferPackagesItemModel.dummy()), - */ - - Container( - margin: EdgeInsets.only(left: 15, right: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomeHealthCareIndexPage(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/home_health_care_icon.png', - width: 50, - height: 50, + if(projectViewModel.havePrivilege(64)||projectViewModel.havePrivilege(65)||projectViewModel.havePrivilege(67)) + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if(projectViewModel.havePrivilege(64)) + DashboardItem( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomeHealthCareIndexPage(), ), - SizedBox( - height: 3, + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/home_health_care_icon.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context) + .homeHealthCareService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context).homeHealthCareService, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'home_healthcare_service_bg.png', + opacity: 0.5, ), - ), - height: MediaQuery.of(context).size.width * 0.4, - imageName: 'home_healthcare_service_bg.png', - opacity: 0.5, - ), - DashboardItem( - onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())), - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/pharmacy_logo.png', - width: 40, - height: 40, - ), - SizedBox( - height: 20, + if(projectViewModel.havePrivilege(65)) + DashboardItem( + onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())), + + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/pharmacy_logo.png', + width: 40, + height: 40, + ), + SizedBox( + height: 20, + ), + Texts( + TranslationBase.of(context).onlinePharmacy, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context).onlinePharmacy, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'al-habib_onlne_pharmacy_bg.png', ), - ), - height: MediaQuery.of(context).size.width * 0.4, - imageName: 'al-habib_onlne_pharmacy_bg.png', - ), - DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: CMCIndexPage(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/comprehensive_medical_checkup_logo.png', - width: 50, - height: 50, + if(projectViewModel.havePrivilege(67)) + DashboardItem( + onTap: (){ + Navigator.push( + context, + FadePage( + page: CMCIndexPage(), ), - SizedBox( - height: 3, + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/comprehensive_medical_checkup_logo.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context).emergencyService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context).emergencyService, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + color: HexColor("#747C80"), + imageName: 'emergency_service_image.png', ), - ), - height: MediaQuery.of(context).size.width * 0.4, - color: HexColor("#747C80"), - imageName: 'emergency_service_image.png', - ), - ], + ], + ), ), - ), SizedBox( height: 8, ), InkWell( - onTap: () => Navigator.push(context, FadePage(page: PaymentService())), + onTap: () => + Navigator.push(context, FadePage(page: PaymentService())), child: Container( margin: EdgeInsets.only(left: 15, right: 15), child: Row( @@ -512,7 +578,8 @@ class _HomePageState extends State { height: 5, ), Texts( - TranslationBase.of(context).onlinePaymentService, + TranslationBase.of(context) + .onlinePaymentService, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -543,7 +610,8 @@ class _HomePageState extends State { height: 10, ), Texts( - TranslationBase.of(context).offersAndPackages, + TranslationBase.of(context) + .offersAndPackages, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -559,46 +627,48 @@ class _HomePageState extends State { borderRadius: BorderRadius.circular(6.0), color: Colors.white, )), - Container( - width: MediaQuery.of(context).size.width * 0.29, - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: ErOptions( - isAppbar: true, - ))), - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/Dr_Schedule_report.png', - width: 50, - height: 50, - ), - SizedBox( - height: 10, - ), - Texts( - TranslationBase.of(context).emergencyServices, - textAlign: TextAlign.center, - color: Colors.black87, - bold: false, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + if(projectViewModel.havePrivilege(60)) + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: ErOptions( + isAppbar: true, + ))), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/Dr_Schedule_report.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .emergencyServices, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), ), ), ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + ), ), - height: MediaQuery.of(context).size.width * 0.4, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, - ), - ), ], ), ), @@ -624,7 +694,8 @@ class _HomePageState extends State { fontWeight: FontWeight.normal, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -645,14 +716,15 @@ class _HomePageState extends State { opacity: 0.5, color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, - onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService( - ))), + onTap: () => Navigator.push( + context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( onTap: () { // Navigator.push( // context, FadePage(page: FeedbackHomePage())); - Navigator.push(context, FadePage(page: ContactUsPage())); + Navigator.push( + context, FadePage(page: ContactUsPage())); }, child: Container( width: double.infinity, @@ -675,7 +747,7 @@ class _HomePageState extends State { child: Container(), ), Texts( - TranslationBase.of(context).viewAll, + TranslationBase.of(context).viewMore, color: Colors.white, fontWeight: FontWeight.normal, ) @@ -692,7 +764,7 @@ class _HomePageState extends State { ), ), SizedBox( - height: 130, + height: 120, ) ], ), @@ -703,24 +775,23 @@ class _HomePageState extends State { } navigateToCovidDriveThru() { - Navigator.push(context, MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); + Navigator.push(context, + MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); } } class DashboardItem extends StatelessWidget { const DashboardItem( {this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 1.0, - this.icon, - this.hasColorFilter = true, - this.margin = 0}) + this.imageName, + @required this.child, + this.onTap, + Key key, + this.width, + this.height, + this.color, + this.opacity = 0.4, + this.hasColorFilter = true}) : super(key: key); final bool hasBorder; final String imageName; @@ -730,9 +801,8 @@ class DashboardItem extends StatelessWidget { final double height; final Color color; final double opacity; - final double margin; - final Widget icon; final bool hasColorFilter; + @override Widget build(BuildContext context) { return InkWell( @@ -742,25 +812,27 @@ class DashboardItem extends StatelessWidget { height: height != null ? height : MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.19 - : MediaQuery.of(context).size.height * 0.35, + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( color: !hasBorder ? color != null - ? color - : HexColor('#050705').withOpacity(opacity) + ? color + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), - border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), + border: hasBorder + ? Border.all(width: 1.0, color: const Color(0xffcccccc)) + : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( - image: ExactAssetImage('assets/images/$imageName'), - fit: BoxFit.cover, - colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, - ) - : icon, + image: ExactAssetImage('assets/images/$imageName'), + fit: BoxFit.cover, + colorFilter: hasColorFilter ? new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, + ) + : null, ), - margin: EdgeInsets.all(margin), child: Center( child: child, ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 3cf01ae6..8c8f17fb 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,6 +1,4 @@ -import 'dart:convert'; import 'dart:io'; -import 'dart:typed_data'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -26,6 +24,7 @@ import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; @@ -62,25 +61,28 @@ class _LandingPageState extends State with WidgetsBindingObserver { var themeNotifier; ///inject the user data - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = locator< + AuthenticatedUserObject>(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); var event = RobotProvider(); var familyFileProvider = family.FamilyFilesProvider(); + void _requestIOSPermissions() { flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< - IOSFlutterLocalNotificationsPlugin>() + IOSFlutterLocalNotificationsPlugin>() ?.requestPermissions( - alert: true, - badge: true, - sound: true, - ); + alert: true, + badge: true, + sound: true, + ); } bool isPageNavigated = false; LocationUtils locationUtils; + _changeCurrentTab(int tab) { setState(() { currentTab = tab; @@ -108,9 +110,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (!isPageNavigated) { isPageNavigated = true; Navigator.push( - context, - MaterialPageRoute( - builder: (context) => IncomingCall( + context, + MaterialPageRoute( + builder: (context) => + IncomingCall( incomingCallData: LandingPage.incomingCallData))) .then((value) { isPageNavigated = false; @@ -149,7 +152,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] HMGNetworkConnectivity(context, () { GifLoaderDialogUtils.showMyDialog(context); - PlatformBridge().connectHMGGuestWifi().then((value) => {GifLoaderDialogUtils.hideDialog(context)}); + PlatformBridge().connectHMGGuestWifi().then((value) => + { + GifLoaderDialogUtils.hideDialog(context) + }); }).checkAndConnectIfNoInternet(); if (Platform.isIOS) { @@ -167,12 +173,12 @@ class _LandingPageState extends State with WidgetsBindingObserver { } }); - if (results[Permission.location].isGranted) ; - if (results[Permission.storage].isGranted) ; - if (results[Permission.camera].isGranted) ; - if (results[Permission.photos].isGranted) ; - if (results[Permission.accessMediaLocation].isGranted) ; - if (results[Permission.calendar].isGranted) ; + if (results[Permission.location].isGranted); + if (results[Permission.storage].isGranted); + if (results[Permission.camera].isGranted); + if (results[Permission.photos].isGranted); + if (results[Permission.accessMediaLocation].isGranted); + if (results[Permission.calendar].isGranted); }); requestPermissions(); // }); @@ -298,8 +304,12 @@ class _LandingPageState extends State with WidgetsBindingObserver { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: message, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, + okText: TranslationBase + .of(context) + .confirm, + cancelText: TranslationBase + .of(context) + .cancel_nocaps, okFunction: () => {}, cancelFunction: () => {}); dialog.showAlertDialog(context); @@ -325,149 +335,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { return permissionResults; } - @override - Widget build(BuildContext context) { - projectViewModel = Provider.of(context); - - return Scaffold( - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text( - getText(currentTab).toUpperCase(), - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.white, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), - // bold: true, - // color: Colors.white, - ), - leading: Builder( - builder: (BuildContext context) { - return new Stack( - children: [ - IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ), - notificationCount != '' - ? new Positioned( - right: projectViewModel.isArabic ? 35 : 0, - top: 5, - child: new Container( - padding: EdgeInsets.all(4), - decoration: new BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - notificationCount, - style: new TextStyle( - color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, - ), - textAlign: TextAlign.center, - ), - ), - ) - : SizedBox() - ], - ); - }, - ), - actions: [ - IconButton( - //iconSize: 70, - icon: Icon( - projectViewModel.isLogin ? Icons.settings : Icons.login, - color: Colors.white, - ), - onPressed: () { - if (projectViewModel.isLogin) - Navigator.of(context).pushNamed( - SETTINGS, - ); - else - login(); - }, //do something, - ) - ], - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - extendBody: true, - body: PageView( - physics: NeverScrollableScrollPhysics(), - controller: pageController, - children: [ - HomePage( - goToMyProfile: () { - _changeCurrentTab(1); - }, - ), - MedicalProfilePage(), - BookingOptions(), - MyFamily(isAppbarVisible: false), - ToDo(isShowAppBar: false), - ], // Please do not remove the BookingOptions from this array - ), - bottomNavigationBar: BottomNavBar( - changeIndex: _changeCurrentTab, - index: currentTab, - ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: currentTab == 0 - ? FloatingButton( - elevation: true, - onTap: () { - _changeCurrentTab(2); - }) - : null); - } - - triggerRobot() { - event.setValue({"isRobot": 'true'}); - } - - getText(currentTab) { - switch (currentTab) { - case 0: - return TranslationBase.of(context).home; - case 1: - return TranslationBase.of(context).medicalProfile; - case 2: - return TranslationBase.of(context).mySchedule; - case 3: - return TranslationBase.of(context).services; - case 4: - return TranslationBase.of(context).bookAppo; - } - } - - void checkUserStatus(token) async { - var result = await authService - .selectDeviceImei(token) - ; - setUserValues(result); - registerGeofences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - if (data != null) { - authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {print(res)}); - authService.getDashboard().then((value) => { - setState(() { - notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - }) - }); - } - } setTheme() async { // // defaultTheme = @@ -508,6 +375,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { // ); // themeNotifier.setTheme(defaultTheme); } + void checkUserStatus(token, {isLoader = true}) async { if (isLoader) //GifLoaderDialogUtils.showMyDialog(context); @@ -519,7 +387,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); } - static Future myBackgroundMessageHandler(Map message) async { + static Future myBackgroundMessageHandler( + Map message) async { Map myMap = new Map.from(message['data']); if (message.containsKey('data')) { print("myBackgroundMessageHandler Inside"); @@ -548,27 +417,30 @@ class _LandingPageState extends State with WidgetsBindingObserver { _changeCurrentTab(2); } } - registerGeofences() async { - await locator().getAllGeoZones(GeoZonesRequestModel()); - void doIt() { - getUserInformation().then((value) { - if (value != null) projectViewModel.platformBridge().registerHmgGeofences(); - }); - } + registerGeofences() async { + await locator().getAllGeoZones(GeoZonesRequestModel()); - if (await Permission.location.isGranted) { - doIt(); - } else { - [Permission.location].request().then((value) async { - if (await Permission.location.isGranted) { - doIt(); - } - }); - } + void doIt() { + getUserInformation().then((value) { + if (value != null) projectViewModel.platformBridge() + .registerHmgGeofences(); + }); + } - requestPermissions().then((results) {}); + if (await Permission.location.isGranted) { + doIt(); + } else { + [Permission.location].request().then((value) async { + if (await Permission.location.isGranted) { + doIt(); + } + }); } + + requestPermissions().then((results) {}); + } + login() async { var data = await sharedPref.getObject(IMEI_USER_DATA); sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); @@ -600,26 +472,167 @@ class _LandingPageState extends State with WidgetsBindingObserver { getNotificationCount(token) async { if (await sharedPref.getObject(USER_PROFILE) != null) { var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { authService .registeredAuthenticatedUser(data, token, 0, 0) .then((res) => {print(res)}); - authService.getDashboard().then((value) => { - setState(() { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] > - 99 - ? '99+' - : value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); - - sharedPref.setString(NOTIFICATION_COUNT, notificationCount); - }) - }); + authService.getDashboard().then((value) => + { + setState(() { + notificationCount = value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] > + 99 + ? '99+' + : value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] + .toString(); + + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + }) + }); familyFileProvider.getSharedRecordByStatus(); } } } + + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Scaffold( + appBar: AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text( + getText(currentTab).toUpperCase(), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), + // bold: true, + // color: Colors.white, + ), + leading: Builder( + builder: (BuildContext context) { + return new Stack( + children: [ + IconButton( + icon: Icon(Icons.menu), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ), + notificationCount != '' + ? new Positioned( + right: projectViewModel.isArabic ? 35 : 0, + top: 5, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + notificationCount, + style: new TextStyle( + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 9, + ), + textAlign: TextAlign.center, + ), + ), + ) + : SizedBox() + ], + ); + }, + ), + actions: [ + IconButton( + //iconSize: 70, + icon: Icon( + projectViewModel.isLogin ? Icons.settings : Icons.login, + color: Colors.white, + ), + onPressed: () { + if (projectViewModel.isLogin) + Navigator.of(context).pushNamed( + SETTINGS, + ); + else + login(); + }, //do something, + ) + ], + centerTitle: true, + ), + drawer: SafeArea(child: AppDrawer()), + extendBody: true, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + HomePage( + goToMyProfile: () { + _changeCurrentTab(1); + }, + ), + MedicalProfilePage(), + BookingOptions(), + MyFamily(isAppbarVisible: false), + ToDo(isShowAppBar: false), + ], // Please do not remove the BookingOptions from this array + ), + bottomNavigationBar: BottomNavBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + floatingActionButton: currentTab == 0 + ? FloatingButton( + elevation: true, + onTap: () { + _changeCurrentTab(2); + }) + : null); + } + + triggerRobot() { + event.setValue({"isRobot": 'true'}); + } + + getText(currentTab) { + switch (currentTab) { + case 0: + return TranslationBase + .of(context) + .home; + case 1: + return TranslationBase + .of(context) + .medicalProfile; + case 2: + return TranslationBase + .of(context) + .mySchedule; + case 3: + return TranslationBase + .of(context) + .services; + case 4: + return TranslationBase + .of(context) + .bookAppo; + } + } } + + diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 2b61596c..c48906ca 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index e61d9709..ade69f45 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -18,9 +18,9 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -54,12 +54,15 @@ class MedicalProfilePage extends StatefulWidget { class _MedicalProfilePageState extends State { var authProvider = new AuthProvider(); - + List medical=List(); + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); - return BaseView( + + List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel,context: context,count: appoCountProvider.count,isLogin: projectViewModel.isLogin); + return BaseView( onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( isShowDecPage: false, @@ -85,410 +88,44 @@ class _MedicalProfilePageState extends State { ), if (model.isLogin) ListView.builder( - itemBuilder: (context, index) => TimeLineWidget( + itemBuilder: (context, index) => + TimeLineWidget( isUp: index % 2 == 1, - appoitmentAllHistoryResul: model.appoitmentAllHistoryResultList[index], + appoitmentAllHistoryResul: model + .appoitmentAllHistoryResultList[index], ), - itemCount: model.appoitmentAllHistoryResultList.length, + itemCount: model + .appoitmentAllHistoryResultList.length, scrollDirection: Axis.horizontal, reverse: !projectViewModel.isArabic, ), ], ), ), + SizedBox(height: 50,), Padding( padding: EdgeInsets.symmetric(vertical: 5.0), - child: Column( - children: [ - if (model.isLogin) - Container( - width: double.infinity, - height: 55, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: MyAppointments(), - ), - ); - }, - child: authProvider.isLogin - ? Stack(children: [ - MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: Color(0xFF40ACC9).withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(appoCountProvider.count.toString(), style: TextStyle(color: Colors.white, fontSize: 16.0)), - ), - ), - ), - ]) - : MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).lab, - imagePath: 'lab_result_icon.png', - subTitle: TranslationBase.of(context).labSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).radiology, - imagePath: 'radiology_icon.png', - subTitle: TranslationBase.of(context).radiologySubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).medicines, - imagePath: 'prescription_icon.png', - subTitle: TranslationBase.of(context).medicinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: VitalSignDetailsScreen(), - ), - ), - child: MedicalProfileItem( - title: TranslationBase.of(context).vitalSigns, - imagePath: 'vital_signs.png', - subTitle: TranslationBase.of(context).vitalSignsSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: ActiveMedicationsPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).myMedical, - imagePath: 'active_medications.png', - subTitle: TranslationBase.of(context).myMedicalSubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: VitalSignDetailsScreen())); - Navigator.push( - context, - FadePage( - page: DoctorHomePage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .vitalSigns, - imagePath: 'vital_sign_icon.png', - subTitle: TranslationBase.of(context) - .vitalSignsSubtitle, - title: TranslationBase.of(context).myDoctor, - imagePath: 'doctor_icon.png', - subTitle: TranslationBase.of(context).myDoctorSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: EyeMeasurementsPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).eye, - imagePath: 'eye_measurement_icon.png', - subTitle: TranslationBase.of(context).eyeSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).insurance, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context).insuranceSubtitle, - ), - ), - ), - ], - ), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).updateInsurance, - imagePath: 'insurance_update_icon_.png', - subTitle: TranslationBase.of(context).updateInsuranceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).insuranceApproval, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).allergies, - imagePath: 'my_allergies_icon.png', - subTitle: TranslationBase.of(context).allergiesSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyVaccines())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).myVaccines, - imagePath: 'my_vaccines_icon.png', - subTitle: TranslationBase.of(context).myVaccinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: HomeReportPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).medical, - imagePath: 'medical_reports_icon.png', - subTitle: TranslationBase.of(context).medicalSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MonthlyReportsPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).monthly, - imagePath: 'monthly_reports_icon.png', - subTitle: TranslationBase.of(context).monthlySubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: PatientSickLeavePage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', - subTitle: TranslationBase.of(context).sickSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyBalancePage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).myBalance, - imagePath: 'check-in.png', - subTitle: TranslationBase.of(context).myBalanceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: MedicalProfileItem( - title: TranslationBase.of(context).patientCall, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context).patientCallSubtitle, - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO - onTap: () { - Navigator.push(context, FadePage(page: SmartWatchInstructions())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context).smartWatchesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyTrackers())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).myTrackers, - imagePath: 'my_tracker_icon.png', - subTitle: TranslationBase.of(context).myTrackersSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: AskDoctorHomPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).askYour, - imagePath: 'ask_doctor_icon.png', - subTitle: TranslationBase.of(context).askYourSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO - onTap: () { - if (authProvider.isLogin) { - String patientID = authProvider.getAuthenticatedUser().patientID.toString(); - GifLoaderDialogUtils.showMyDialog(context); - projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}); - } else { - AlertDialogBox( - context: context, - confirmMessage: "Please login with your account first to use this feature", - okText: "OK", - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - }).showAlertDialog(context); - } - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).internet, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context).internetSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( -// onTap: () { -// Navigator.push( -// context, FadePage(page: InsuranceApproval())); -// }, - child: MedicalProfileItem( - title: TranslationBase.of(context).chatbot, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context).chatbotSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: Container(), - ), - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ) - ], + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 2.40), + ), + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + + return myMedicalList[index]; + }, ), ) ], ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.12, + ), if (model.user != null && model.isLogin) Positioned( top: 185, @@ -500,9 +137,14 @@ class _MedicalProfilePageState extends State { decoration: BoxDecoration( color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, - border: Border.all(color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(9)), - image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(9)), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/bg_graphic.png'), + fit: BoxFit.cover)), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -511,7 +153,9 @@ class _MedicalProfilePageState extends State { height: 8, ), Texts( - model.user.firstName + " " + model.user.lastName, + model.user.firstName + + " " + + model.user.lastName, color: Colors.white, bold: true, ), @@ -543,4 +187,20 @@ class _MedicalProfilePageState extends State { ), ); } + + fullMedicalData(){ + if(projectViewModel.havePrivilege(5)) + {} + } +} + +class Medical{ + + final String title; + final String imagePath; + final String subTitle; + final Widget page; + + Medical({this.title, this.imagePath, this.subTitle, this.page}); + } diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index 06a31848..43bc9f0a 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -48,7 +48,7 @@ class VitalSingChartAndDetials extends StatelessWidget { if (vitalList.length > 0) { vitalList.reversed.toList().forEach( (element) { - if( element.toJson()[viewKey]?.toInt()!=0) + if( element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0) timeSeriesData.add( TimeSeriesSales2( new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index 0b148f49..e0367ba3 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -19,9 +19,10 @@ class LocalNotification { _instance._onNotificationClick = onNotificationClick; _instance._initialize(); }else{ - assert(false,(){ - "LocalNotification Already Initialized"; - }); + // assert(false,(){ + // //TODO fix it + // "LocalNotification Already Initialized"; + // }); } } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 3e1e4892..34c0e58d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -2,7 +2,33 @@ import 'dart:convert'; import 'dart:core'; import 'dart:typed_data'; +import 'package:badges/badges.dart'; import 'package:connectivity/connectivity.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart'; +import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; +import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; +import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -160,7 +186,340 @@ class Utils { .hasMatch(email); } + static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + List medical = List(); + if (projectViewModel.havePrivilege(5)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: MyAppointments(), + ), + ); + }, + child: isLogin + ? Container( + height: 120, + child: Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: Color(0xFF40ACC9).withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: + TextStyle(color: Colors.white, fontSize: 16.0)), + ), + ), + ), + ]), + ) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + )); + } + if (projectViewModel.havePrivilege(10)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).lab, + imagePath: 'lab_result_icon.png', + subTitle: TranslationBase.of(context).labSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(7)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology_icon.png', + subTitle: TranslationBase.of(context).radiologySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(12)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'prescription_icon.png', + subTitle: TranslationBase.of(context).medicinesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(25)) { + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen(), + ), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).vitalSigns, + imagePath: 'vital_signs.png', + subTitle: TranslationBase.of(context).vitalSignsSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(48)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: ActiveMedicationsPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).myMedical, + imagePath: 'active_medications.png', + subTitle: TranslationBase.of(context).myMedicalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(6)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'doctor_icon.png', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(14)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: EyeMeasurementsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', + subTitle: TranslationBase.of(context).eyeSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(22)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insurance, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).insuranceSubtitle, + ), + )); + } + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).updateInsurance, + imagePath: 'insurance_update_icon_.png', + subTitle: TranslationBase.of(context).updateInsuranceSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(18)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceApproval())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(23)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context).allergiesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(26)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyVaccines())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context).myVaccinesSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(20)) + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomeReportPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medical, + imagePath: 'medical_reports_icon.png', + subTitle: TranslationBase.of(context).medicalSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(19)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MonthlyReportsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context).monthlySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(16)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PatientSickLeavePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context).sickSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(47)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyBalancePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context).myBalanceSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(61)) { + medical.add(MedicalProfileItem( + title: TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context).patientCallSubtitle, + )); + } + + if (projectViewModel.havePrivilege(24)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyTrackers())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context).myTrackersSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(30)) + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: SmartWatchInstructions())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context).smartWatchesSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(28)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: AskDoctorHomPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).askYour, + imagePath: 'ask_doctor_icon.png', + subTitle: TranslationBase.of(context).askYourSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(32)) { + medical.add(InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).internet, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).internetSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(40)) { + medical.add(InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).chatbotSubtitle, + ), + )); + } + + return medical; + } } + // extension function that use in iterations(list.. etc) to iterate items and get index and item it self extension IndexedIterable on Iterable { Iterable mapIndexed(T Function(E e, int i) f) { diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart new file mode 100644 index 00000000..cf91520a --- /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 diff --git a/pubspec.yaml b/pubspec.yaml index 00fb4558..2cac9435 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -80,8 +80,6 @@ dependencies: # charts charts_flutter: ^0.9.0 - #image banner slider - carousel_slider: ^2.3.1 google_maps_flutter: ^1.0.3