fix issues

merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
parent 18dad434a0
commit f77d2b497e

@ -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 {

@ -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

@ -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';

@ -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<String, dynamic> json) {
iD = json['ID'];
serviceName = json['ServiceName'];
privilege = json['Previlege'];
region = json['Region'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['ServiceName'] = this.serviceName;
data['Previlege'] = this.privilege;
data['Region'] = this.region;
return data;
}
}

@ -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> 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<String, dynamic> 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<GetCityInfoList>();
json['GetCityInfo_List'].forEach((v) {
getCityInfoList.add(new GetCityInfoList.fromJson(v));
});
}
getTodayWeatherForecastList = json['GetTodayWeatherForecastList'];
iniciesList = json['IniciesList'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
category1 = json['Category1'];
category2 = json['Category2'];
category3 = json['Category3'];
category4 = json['Category4'];
category5 = json['Category5'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Category1'] = this.category1;
data['Category2'] = this.category2;
data['Category3'] = this.category3;
data['Category4'] = this.category4;
data['Category5'] = this.category5;
return data;
}
}

@ -24,7 +24,8 @@ class MyBalanceService extends BaseService {
String logInTokenID;
String verificationCode;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
MyBalanceService(){
getFamilyFiles();
@ -65,13 +66,14 @@ class MyBalanceService extends BaseService {
}, body: body);
}
getPatientInfoByPatientIDAndMobileNumber() async {
getPatientInfoByPatientIDAndMobileNumber(AdvanceModel advanceModel) async {
hasError = false;
super.error = "";
Map<String, dynamic> 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<String, dynamic> 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;

@ -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<PrivilegeModel> privilegeModelList = List();
Future getPrivilege() async {
Map<String, dynamic> 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);
}
}

@ -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);

@ -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<BaseViewModel>()
bool isLoginChild = false;
List<PrivilegeModel> privilegeRootUser = List();
List<PrivilegeModel> privilegeChildUser = List();
List<PrivilegeModel> 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<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild;
privilegeRootUser = privilege;
notifyListeners();
}
setPrivilege({privilegeList, bool isLoginChild = false}) {
List<PrivilegeModel> 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();

@ -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<WeatherService>();
List<GetCityInfoList> 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);
}
}

File diff suppressed because it is too large Load Diff

@ -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<LandingPage> with WidgetsBindingObserver {
var themeNotifier;
///inject the user data
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
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<LandingPage> 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<LandingPage> 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<LandingPage> 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<LandingPage> 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<LandingPage> 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: <Widget>[
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<LandingPage> with WidgetsBindingObserver {
// );
// themeNotifier.setTheme(defaultTheme);
}
void checkUserStatus(token, {isLoader = true}) async {
if (isLoader)
//GifLoaderDialogUtils.showMyDialog(context);
@ -519,7 +387,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
});
}
static Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) async {
static Future<dynamic> myBackgroundMessageHandler(
Map<String, dynamic> message) async {
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message['data']);
if (message.containsKey('data')) {
print("myBackgroundMessageHandler Inside");
@ -548,27 +417,30 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
_changeCurrentTab(2);
}
}
registerGeofences() async {
await locator<GeofencingServices>().getAllGeoZones(GeoZonesRequestModel());
void doIt() {
getUserInformation().then((value) {
if (value != null) projectViewModel.platformBridge().registerHmgGeofences();
});
}
registerGeofences() async {
await locator<GeofencingServices>().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<LandingPage> 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: <Widget>[
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;
}
}
}

@ -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';

@ -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<MedicalProfilePage> {
var authProvider = new AuthProvider();
List<Medical> medical=List();
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
return BaseView<MedicalViewModel>(
List<Widget> myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel,context: context,count: appoCountProvider.count,isLogin: projectViewModel.isLogin);
return BaseView<MedicalViewModel>(
onModelReady: (model) => model.getAppointmentHistory(),
builder: (_, model, widget) => AppScaffold(
isShowDecPage: false,
@ -85,410 +88,44 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
),
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: <Widget>[
if (model.isLogin)
Container(
width: double.infinity,
height: 55,
),
Row(
children: <Widget>[
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: <Widget>[
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: <Widget>[
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: <Widget>[
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: <Widget>[
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: <Widget>[
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: <Widget>[
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: <Widget>[
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<MedicalProfilePage> {
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<MedicalProfilePage> {
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<MedicalProfilePage> {
),
);
}
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});
}

@ -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),

@ -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";
// });
}
}

@ -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<Widget> myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
List<Widget> 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<E> on Iterable<E> {
Iterable<T> mapIndexed<T>(T Function(E e, int i) f) {

@ -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;
}

@ -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

Loading…
Cancel
Save