Merge branch 'diplomatic-quarter-live' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into diplomatic-quarter-haroon

fix_issues
haroon amjad 4 years ago
commit 92db2b2be9

@ -997,7 +997,7 @@ const Map localizedValues = {
"selectClinic": {"en": "Select Clinic", "ar": " بحث بالعيادة"},
"reviews": {"en": "Reviews", "ar": "تقييمات"},
"searchItemError": {"en": "Item name should be more than 3 character ", "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف"},
"YouCanFind": {"en": "YouCanFind", "ar": "باستطاعتك العثور على "},
"YouCanFind": {"en": "You Can Find ", "ar": "باستطاعتك العثور على "},
"ItemInSearch": {"en": " Item In Search", "ar": " عنصر في البحث "},
"InvoiceNo": {"en": " Invoice No", "ar": "رقم الفاتورة"},
"SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"},

@ -4,7 +4,7 @@ class PharmaciesListModel {
int languageID;
String stamp;
String iPAdress;
double versionID;
dynamic versionID;
String tokenID;
String sessionID;
bool isLoginForDoctorApp;
@ -14,7 +14,7 @@ class PharmaciesListModel {
int editedBy;
int projectID;
int clinicID;
double price;
dynamic price;
String imageLocation;
String desLocation;
String itemDes;

@ -140,7 +140,7 @@ class BaseAppClient {
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (!parsed['IsAuthenticated']) {
await logout();
// await logout();
//helpers.showErrorToast('Your session expired Please login agian');
} else {

@ -1,12 +1,18 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.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';
@ -21,6 +27,7 @@ import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:provider/provider.dart';
class MyFamily extends StatefulWidget {
final bool isAppbarVisible;
@ -35,15 +42,23 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
var userID;
TabController _tabController;
int _tabIndex = 0;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel;
AuthenticatedUser user;
@override
void initState() {
_tabController = new TabController(length: 2, vsync: this, initialIndex: 0);
checkUserData();
super.initState();
}
bool expandFlag = false;
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return AppScaffold(
appBarTitle: TranslationBase.of(context).myFamilyFiles,
isShowAppBar: widget.isAppbarVisible,
@ -87,7 +102,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
//indicatorSize: TabBarIndicatorSize.label,
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Colors.red[800],
indicatorColor: Theme.of(context).primaryColor,
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
@ -117,14 +132,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
child: (user != null && projectViewModel.isLogin) ? TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
myFamilyDetails(context),
myFamilyRequest(context)
],
),
) : Container(child:AppText('Loading..')),
)
],
),
@ -169,7 +184,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Widget myFamilyDetails(context) {
return Container(
height: MediaQuery.of(context).size.height,
margin: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0.0),
margin: EdgeInsets.fromLTRB(20.0, 25.0, 20.0, 0.0),
child: Column(
children: <Widget>[
Expanded(
@ -540,12 +555,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
}
Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async {
if (await sharedPref.getObject(FAMILY_FILE) != null) {
// print(await sharedPref.getObject(FAMILY_FILE));
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(
await sharedPref.getObject(FAMILY_FILE)));
} else {
return familyFileProvider.getSharedRecordByStatus();
if (user != null) {
if (await sharedPref.getObject(FAMILY_FILE) != null) {
// print(await sharedPref.getObject(FAMILY_FILE));
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(
await sharedPref.getObject(FAMILY_FILE)));
} else {
return familyFileProvider.getSharedRecordByStatus();
}
}
}
@ -592,20 +609,55 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
}
switchUser(user, context) {
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
// this
// .familyFileProvider
// .silentLoggin(user)
// .then((value) => loginAfter(value, context));
// Utils.showProgressDialog(context);
this
.familyFileProvider
.silentLoggin(user)
.then((value) => loginAfter(value, context));
.silentLoggin(user is AuthenticatedUser ? null : user,
mainUser: user is AuthenticatedUser)
.then((value) => loginAfter(value, context))
.catchError((err) {
print(err);
AppToast.showErrorToast(message: err);
Navigator.of(context).pop();
});
}
loginAfter(result, context) async{
GifLoaderDialogUtils.hideDialog(context);
var familyFile = await sharedPref.getObject(FAMILY_FILE);
// var familyFile = await sharedPref.getObject(FAMILY_FILE);
// var mainUser = await sharedPref.getObject(MAIN_USER);
// result = CheckActivationCode.fromJson(result);
// this.sharedPref.clear();
// this.sharedPref.setObject(FAMILY_FILE, familyFile);
// this.sharedPref.setObject(MAIN_USER, mainUser);
// result.list.isFamily = true;
// this.sharedPref.setObject(USER_PROFILE, result.list);
// this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID);
// this.sharedPref.setString(TOKEN, result.authenticationTokenID);
//
// authenticatedUserObject.isLogin = true;
// appointmentRateViewModel.isLogin = true;
// projectViewModel.isLogin = true;
// //this.checkIfUserAgreedBefore(result),
// Navigator.of(context).pushNamed(
// HOME,
// );
result = CheckActivationCode.fromJson(result);
var familyFile = await sharedPref.getObject(FAMILY_FILE);
var mainUser = await sharedPref.getObject(MAIN_USER);
this.sharedPref.clear();
this.sharedPref.setObject(FAMILY_FILE, familyFile);
if (mainUser["PatientID"] != result.list.patientID) {
result.list.isFamily = true;
}
this.sharedPref.setObject(MAIN_USER, mainUser);
this.sharedPref.setObject(USER_PROFILE, result.list);
this.sharedPref.setObject(FAMILY_FILE, familyFile);
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID);
this.sharedPref.setString(TOKEN, result.authenticationTokenID);
//this.checkIfUserAgreedBefore(result),
@ -634,4 +686,17 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
refreshFamily(context)
});
}
checkUserData() async{
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
var data2 = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(MAIN_USER));
print(data2);
setState(() {
this.user = data;
});
}
}
}

@ -43,12 +43,12 @@ class _HomePageState extends State<HomePage> {
ToDoCountProviderModel toDoProvider;
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
getToDoCount();
});
super.initState();
}
// void initState() {
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// getToDoCount();
// });
// super.initState();
// }
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();

@ -26,7 +26,7 @@ import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
import 'package:local_auth/local_auth.dart';
import 'package:provider/provider.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart';
// import 'package:smart_progress_bar/smart_progress_bar.dart';
class ConfirmLogin extends StatefulWidget {
@override
@ -69,12 +69,11 @@ class _ConfirmLogin extends State<ConfirmLogin> {
int fingrePrintBefore;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel;
@override
void initState() {
_getAvailableBiometrics();
@ -367,25 +366,25 @@ class _ConfirmLogin extends State<ConfirmLogin> {
localizedReason: 'Scan your fingerprint to authenticate',
useErrorDialogs: true,
stickyAuth: true);
if (authenticated == true) {
if(user !=null && (user.logInType==2 || user.logInType ==3)){
this.checkActivationCode();
}else{
var request = this.getCommonRequest(type: type);
this.getMobileInfo(request);
}
if (authenticated == true) {
if (user != null && (user.logInType == 2 || user.logInType == 3)) {
this.checkActivationCode();
} else {
var request = this.getCommonRequest(type: type);
this.getMobileInfo(request);
}
}
}
}
getMobileInfo(request) {
GifLoaderDialogUtils.showMyDialog(context);
this
.authService
.getLoginInfo(request)
.then((result) => {
GifLoaderDialogUtils.hideDialog(context),
if (result['SMSLoginRequired'] == false)
{
this.loginTokenID = result.logInTokenID,
@ -422,9 +421,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
})
.catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
});
}
setUser() async {}
@ -460,7 +459,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.deviceToken = await sharedPref.getString(PUSH_TOKEN);
this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null
? await sharedPref.getInt(LAST_LOGIN)
: user !=null ? user.logInType : null;
: user != null
? user.logInType
: null;
//this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN);
}
@ -514,7 +515,6 @@ class _ConfirmLogin extends State<ConfirmLogin> {
.then((result) => {
if (result is Map)
{
result = CheckActivationCode.fromJson(result),
if (this.registerd_data != null &&
this.registerd_data.isRegister == true)
@ -570,7 +570,6 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
goToHome() {
authenticatedUserObject.isLogin = true;
appointmentRateViewModel.isLogin = true;
projectViewModel.isLogin = true;
@ -756,7 +755,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
bool checkIfBiometricAvailable(BiometricType biometricType) {
bool isAvailable = false;
if(_availableBiometrics != null) {
if (_availableBiometrics != null) {
for (var i = 0; i < _availableBiometrics.length; i++) {
if (biometricType == _availableBiometrics[i]) isAvailable = true;
}

@ -1,23 +1,23 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/drug_item.dart';
import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../base/base_view.dart';
class MedicineSearch extends StatelessWidget {
final textController = TextEditingController();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return BaseView<PharmacyViewModel>(
@ -51,11 +51,13 @@ class MedicineSearch extends StatelessWidget {
controller: textController,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context).pleaseEnterMedicineName;
}else if( value.length <4){
return TranslationBase.of(context).searchItemError;
}else
return null;
return TranslationBase.of(context)
.pleaseEnterMedicineName;
} else if (value.length < 4) {
return TranslationBase.of(context)
.searchItemError;
} else
return null;
},
),
),
@ -81,21 +83,24 @@ class MedicineSearch extends StatelessWidget {
],
),
),
if(model.pharmacy.isNotEmpty)
Container(
margin: EdgeInsets.only(
left: SizeConfig.heightMultiplier * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
TranslationBase.of(context).youCanFind+
'${model.pharmacy == null ? '0' : model.pharmacy.length.toString()}'+
TranslationBase.of(context).itemInSearch,
),
],
if (model.pharmacy.isNotEmpty)
Container(
margin: EdgeInsets.only(
left: SizeConfig.heightMultiplier * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
child: Texts(
TranslationBase.of(context).youCanFind +
'${model.pharmacy == null ? '0' : model.pharmacy.length.toString()}' +
TranslationBase.of(context).itemInSearch,
),
),
],
),
),
),
if (model.state == ViewState.ErrorLocal)
Container(
child: Texts(model.error),

@ -1,20 +1,19 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'dart:typed_data';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:maps_launcher/maps_launcher.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart';
import 'dart:typed_data';
import 'dart:convert';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
import 'package:map_launcher/map_launcher.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
import '../base/base_view.dart';
class PharmaciesList extends StatelessWidget {
final int medicineID;
final String imageURL;
@ -30,6 +29,7 @@ class PharmaciesList extends StatelessWidget {
AppScaffold(
appBarTitle: TranslationBase.of(context).pharmaciesList,
baseViewModel: model,
isShowAppBar: true,
body: Container(
height: SizeConfig.screenHeight,
child: ListView(

@ -37,8 +37,10 @@ const String SENT_REQUEST_URL =
'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus';
const String RECEVIED_REQUEST_URL =
'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId';
const ACCEPT_REJECT_FAMILY = 'Services/Authentication.svc/REST/Update_FileStatus';
const DEACTIVATE_FAMILY = 'Services/Authentication.svc/REST/DeactivateRequestByRensponse';
const ACCEPT_REJECT_FAMILY =
'Services/Authentication.svc/REST/Update_FileStatus';
const DEACTIVATE_FAMILY =
'Services/Authentication.svc/REST/DeactivateRequestByRensponse';
class FamilyFilesProvider with ChangeNotifier {
bool isLogin = false;
@ -49,7 +51,9 @@ class FamilyFilesProvider with ChangeNotifier {
try {
dynamic localRes;
var request = GetAllSharedRecordsByStatusReq();
var result = await sharedPref.getObject(MAIN_USER);
request.status = 0;
request.patientID = result["PatientID"];
await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
@ -57,7 +61,7 @@ class FamilyFilesProvider with ChangeNotifier {
AppToast.showErrorToast(message: error);
throw error;
}, body: request.toJson());
sharedPref.setObject(FAMILY_FILE, localRes);
return Future.value(
GetAllSharedRecordsByStatusResponse.fromJson(localRes));
@ -80,7 +84,7 @@ class FamilyFilesProvider with ChangeNotifier {
return Future.error(error);
}, body: request);
if (localRes != null) {
sharedPref.setObject(FAMILY_FILE, localRes);
// sharedPref.setObject(FAMILY_FILE, localRes);
allSharedRecordsByStatusResponse =
GetAllSharedRecordsByStatusResponse.fromJson(localRes);
return Future.value(allSharedRecordsByStatusResponse);
@ -105,7 +109,7 @@ class FamilyFilesProvider with ChangeNotifier {
//AppToast.showErrorToast(message: error);
//throw error;
}, body: request);
sharedPref.setObject(FAMILY_FILE, localRes);
//sharedPref.setObject(FAMILY_FILE, localRes);
return Future.value(
GetAllSharedRecordsByStatusResponse.fromJson(localRes));
} catch (error) {
@ -251,9 +255,9 @@ class FamilyFilesProvider with ChangeNotifier {
Future<dynamic> silentLoggin(GetAllSharedRecordsByStatusList switchUser,
{onSuccess, mainUser}) async {
Map<String, dynamic> request = {};
if(mainUser ==true){
if (mainUser == true) {
var currentUser =
AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER));
AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER));
//const request = new SwitchUserRequest();
request['LogInTokenID'] = '';
request['PatientOutSA'] = currentUser.outSA; //? 1 : 0;
@ -267,9 +271,9 @@ class FamilyFilesProvider with ChangeNotifier {
request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966";
request['activationCode'] = '0000';
request['isRegister'] = false;
}else {
} else {
var currentUser =
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
//const request = new SwitchUserRequest();
request['LogInTokenID'] = '';
@ -309,11 +313,11 @@ class FamilyFilesProvider with ChangeNotifier {
await new BaseAppClient().post(ACCEPT_REJECT_FAMILY,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
@ -321,17 +325,18 @@ class FamilyFilesProvider with ChangeNotifier {
throw error;
}
}
Future<dynamic> deactivateFamily(request) async {
try {
dynamic localRes;
await new BaseAppClient().post(DEACTIVATE_FAMILY,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
return Future.value(localRes);
} catch (error) {
@ -339,6 +344,4 @@ class FamilyFilesProvider with ChangeNotifier {
throw error;
}
}
}

@ -244,7 +244,7 @@ class _TextsState extends State<Texts> {
Theme.of(context).backgroundColor.withOpacity(0),
], begin: Alignment.bottomCenter, end: Alignment.topCenter),
),
height: 30.0,
height: 32.0,
),
)
],

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.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/text/app_texts_widget.dart';
@ -40,7 +41,8 @@ class _AppDrawerState extends State<AppDrawer> {
var familyFileProvider = FamilyFilesProvider();
AuthenticatedUser user;
AuthenticatedUser mainUser;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<
AuthenticatedUserObject>();
VitalSignService _vitalSignService = locator<VitalSignService>();
@ -48,7 +50,10 @@ class _AppDrawerState extends State<AppDrawer> {
Widget build(BuildContext context) {
projectProvider = Provider.of(context);
return SizedBox(
width: MediaQuery.of(context).size.width * 0.75,
width: MediaQuery
.of(context)
.size
.width * 0.75,
child: Container(
color: Colors.white,
child: Drawer(
@ -67,66 +72,67 @@ class _AppDrawerState extends State<AppDrawer> {
children: <Widget>[
Container(
child:
Image.asset('assets/images/DQ/DQ_logo.png'),
Image.asset('assets/images/DQ/DQ_logo.png'),
margin: EdgeInsets.all(
SizeConfig.imageSizeMultiplier * 4),
),
(user != null && projectProvider.isLogin)
? Padding(
padding: EdgeInsets.all(15),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
padding: EdgeInsets.all(15),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
right: 5),
child: Icon(
Icons.account_circle,
color: Color(0xFF40ACC9),
)),
AppText(
user.firstName +
' ' +
user.lastName,
Padding(
padding: EdgeInsets.only(
right: 5),
child: Icon(
Icons.account_circle,
color: Color(0xFF40ACC9),
)
],
),
Row(children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: 30, top: 5),
child: Column(
children: <Widget>[
AppText(
TranslationBase.of(
context)
.fileno +
": " +
user.patientID
.toString(),
color:
Color(0xFF40ACC9),
fontSize: SizeConfig
.textMultiplier *
1.5,
),
AppText(
user.bloodGroup != null
? 'Blood Group: ' +
user.bloodGroup
: '',
fontSize: SizeConfig
.textMultiplier *
1.5,
),
],
))
])
]))
)),
AppText(
user.firstName +
' ' +
user.lastName,
color: Color(0xFF40ACC9),
)
],
),
Row(children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: 30, top: 5),
child: Column(
children: <Widget>[
AppText(
TranslationBase
.of(
context)
.fileno +
": " +
user.patientID
.toString(),
color:
Color(0xFF40ACC9),
fontSize: SizeConfig
.textMultiplier *
1.5,
),
AppText(
user.bloodGroup != null
? 'Blood Group: ' +
user.bloodGroup
: '',
fontSize: SizeConfig
.textMultiplier *
1.5,
),
],
))
])
]))
: SizedBox(),
],
),
@ -138,7 +144,9 @@ class _AppDrawerState extends State<AppDrawer> {
children: <Widget>[
InkWell(
child: DrawerItem(
TranslationBase.of(context).arabicChange,
TranslationBase
.of(context)
.arabicChange,
Icons.translate),
onTap: () {
// Navigator.of(context).pushNamed(
@ -153,192 +161,263 @@ class _AppDrawerState extends State<AppDrawer> {
),
(user != null && projectProvider.isLogin)
? Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
InkWell(
child: DrawerItem(
TranslationBase.of(context).family,
Icons.group,
textColor: Color(0xFF40ACC9),
iconColor: Color(0xFF40ACC9),
bottomLine: false,
sideArrow: true,
),
onTap: () {
Navigator.of(context).pushNamed(
MY_FAMILIY,
);
},
),
FutureBuilder(
future: getFamilyFiles(), // async work
builder: (BuildContext context,
AsyncSnapshot<
GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(
padding: EdgeInsets.all(10),
child: Text('Loading....'));
default:
if (snapshot.hasError)
return Padding(
padding: EdgeInsets.all(10),
child: Text(snapshot.error));
else
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
// <--- left side
color: Colors.grey[200],
width: 1.0,
),
)),
child: Column(
children: [
user.isFamily == true
? Container(
padding:
EdgeInsets.only(
bottom: 5),
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
user.isFamily == null || user.isFamily == false
? InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.family,
Icons.group,
textColor: Color(0xFF40ACC9),
iconColor: Color(0xFF40ACC9),
bottomLine: false,
sideArrow: true,
),
onTap: () {
Navigator.of(context).pushNamed(
MY_FAMILIY,
);
},
)
: SizedBox(),
FutureBuilder(
future: getFamilyFiles(), // async work
builder: (BuildContext context,
AsyncSnapshot<
GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(
padding: EdgeInsets.all(10),
child: Text('Loading....'));
default:
if (snapshot.hasError)
return Padding(
padding: EdgeInsets.all(10),
child: Text(snapshot.error));
else
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
// <--- left side
color: Colors.grey[200],
width: 1.0,
),
)),
child: Column(
children: [
user.isFamily == true
? Container(
padding:
EdgeInsets.only(
bottom: 5),
child: InkWell(
onTap: () {
switchUser(
mainUser,
context);
},
child: Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <
Widget>[
Expanded(
child: Icon(
Icons
.person),
),
Expanded(
flex: 7,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <
Widget>[
AppText(
mainUser
.firstName +
' ' +
mainUser
.lastName),
AppText(
TranslationBase
.of(
context)
.fileno +
": " +
mainUser
.patientID
.toString()),
])),
],
)))
: SizedBox(),
Column(
mainAxisAlignment:
MainAxisAlignment
.start,
mainAxisSize:
MainAxisSize.min,
children: snapshot.data
.getAllSharedRecordsByStatusList
.map<Widget>(
(result) {
return result
.status ==
3
? Container(
padding: EdgeInsets
.only(
bottom:
5),
child: InkWell(
onTap: () {
switchUser(
mainUser,
result,
context);
},
child: Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
CrossAxisAlignment
.start,
children: <
Widget>[
Expanded(
child: Icon(
Icons
.person),
child:
Icon(Icons
.person,
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
),
Expanded(
flex: 7,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
AppText(mainUser.firstName + ' ' + mainUser.lastName),
AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()),
])),
child: Padding(
padding: EdgeInsets
.only(
left: 5,
right: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: <
Widget>[
AppText(
result
.patientName,
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
AppText(
TranslationBase
.of(
context)
.fileno +
": " +
result
.iD
.toString(),
color: result
.responseID ==
user
.patientID
? Color(
0xFF40ACC9)
: Colors
.black),
]))),
],
)))
: SizedBox(),
Column(
mainAxisAlignment:
MainAxisAlignment
.start,
mainAxisSize:
MainAxisSize.min,
children: snapshot.data
.getAllSharedRecordsByStatusList
.map<Widget>(
(result) {
return result
.status ==
3
? Container(
padding: EdgeInsets
.only(
bottom:
5),
child: InkWell(
onTap: () {
switchUser(
result,
context);
},
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <
Widget>[
Expanded(
child:
Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
),
Expanded(
flex: 7,
child: Padding(
padding:EdgeInsets.only(left:5, right:5),
child:Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black),
]))),
],
)))
: SizedBox();
}).toList())
],
));
}
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context)
.notification,
Icons.notifications),
onTap: () {
//NotificationsPage
Navigator.of(context).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
NotificationsPage()));
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context).appsetting,
Icons.settings_input_composite),
onTap: () {
Navigator.of(context).pushNamed(
SETTINGS,
);
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context).rateApp,
Icons.star),
onTap: () {
if (Platform.isIOS) {
launch(
"https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978");
} else {
launch(
"https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en");
}
},
),
InkWell(
child: DrawerItem(
TranslationBase.of(context).logout,
Icons.lock_open),
onTap: () {
logout();
},
)
],
)
: SizedBox();
}).toList())
],
));
}
},
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.notification,
Icons.notifications),
onTap: () {
//NotificationsPage
Navigator.of(context).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
NotificationsPage()));
},
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.appsetting,
Icons.settings_input_composite),
onTap: () {
Navigator.of(context).pushNamed(
SETTINGS,
);
},
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.rateApp,
Icons.star),
onTap: () {
if (Platform.isIOS) {
launch(
"https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978");
} else {
launch(
"https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en");
}
},
),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.logout,
Icons.lock_open),
onTap: () {
logout();
},
)
],
)
: InkWell(
child: DrawerItem(
TranslationBase.of(context).loginregister,
Icons.lock_open),
onTap: () {
login();
},
),
child: DrawerItem(
TranslationBase
.of(context)
.loginregister,
Icons.lock_open),
onTap: () {
login();
},
),
],
)
],
@ -357,7 +436,9 @@ class _AppDrawerState extends State<AppDrawer> {
children: [
Column(
children: <Widget>[
Text(TranslationBase.of(context).poweredBy),
Text(TranslationBase
.of(context)
.poweredBy),
Image.asset(
'assets/images/cs_logo_container.png',
width: SizeConfig.imageSizeMultiplier * 30,
@ -410,8 +491,8 @@ class _AppDrawerState extends State<AppDrawer> {
authenticatedUserObject.logout();
projectProvider.isLogin = false;
await authenticatedUserObject.getUser();
_vitalSignService.heightCm ="";
_vitalSignService.weightKg ="";
_vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
await sharedPref.clear();
this.user = null;
Navigator.of(context).pushNamed(HOME);
@ -442,18 +523,21 @@ class _AppDrawerState extends State<AppDrawer> {
}
switchUser(user, context) {
Utils.showProgressDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
this
.familyFileProvider
.silentLoggin(user is AuthenticatedUser ? null : user,
mainUser: user is AuthenticatedUser)
.then((value) => loginAfter(value, context))
mainUser: user is AuthenticatedUser)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
loginAfter(value, context);
})
.catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
AppToast.showErrorToast(message: err);
Navigator.of(context).pop();
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
});
}
loginAfter(result, context) async {

@ -29,7 +29,7 @@ class _MedicineItemWidgetState extends State<MedicineItemWidget> {
@override
Widget build(BuildContext context) {
return new RoundedContainer(
height: SizeConfig.heightMultiplier * 12.9,
height: SizeConfig.heightMultiplier * 13.1,
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Row(

Loading…
Cancel
Save