my family switch profile improvement.

merge-update-with-lab-changes
Sikander Saleem 4 years ago
parent 61d0d52c59
commit fd73c248e2

@ -635,7 +635,7 @@ class BaseAppClient {
String getSessionId(String id) { String getSessionId(String id) {
///return id.replaceAll(RegExp('/[^\w\s]/'), ''); ///return id.replaceAll(RegExp('/[^\w\s]/'), '');
return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
} }
static defaultHttpParameters() async { static defaultHttpParameters() async {

@ -24,22 +24,20 @@ class BaseViewModel extends ChangeNotifier {
void setState(ViewState viewState) { void setState(ViewState viewState) {
_state = viewState; _state = viewState;
if (viewState == ViewState.Busy || viewState == ViewState.BusyLocal) if (viewState == ViewState.Busy || viewState == ViewState.BusyLocal) error = "";
error = "";
if (hasListeners) notifyListeners(); if (hasListeners) notifyListeners();
} }
setUser(AuthenticatedUser user){ setUser(AuthenticatedUser user, {bool notify = true}) {
this.user = user; this.user = user;
notifyListeners(); if (notify) notifyListeners();
} }
BaseViewModel() { BaseViewModel() {
//authenticatedUserObject.getUser(); //authenticatedUserObject.getUser();
user = authenticatedUserObject.user; user = authenticatedUserObject.user;
this.isLogin = authenticatedUserObject.isLogin; this.isLogin = authenticatedUserObject.isLogin;
} }
_getUser() async { _getUser() async {

@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -83,7 +84,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
); );
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context); toDoProvider = Provider.of<ToDoCountProviderModel>(context, listen: false);
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).myFamilyFiles, appBarTitle: TranslationBase.of(context).myFamilyFiles,
isShowAppBar: widget.isAppbarVisible, isShowAppBar: widget.isAppbarVisible,
@ -125,155 +126,117 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
) )
: Container(child: AppText('')), : Container(child: AppText('')),
), ),
DefaultButton(
TranslationBase.of(context).addFamilyMember,
() async {
Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE);
},
).insideContainer,
], ],
), ),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(14),
child: DefaultButton(
TranslationBase.of(context).addFamilyMember,
() async {
Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE);
},
),
),
); );
} }
Widget myFamilyDetails(context) { Widget myFamilyDetails(context) {
return Container( return (familySharedRecordsList.length ?? 0) > 0
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), ? ListView.separated(
child: Column( padding: EdgeInsets.all(21),
children: <Widget>[ itemBuilder: (context, index) {
Expanded( bool isFemale = familySharedRecordsList[index].gender == 2;
flex: 4, if (familySharedRecordsList[index].status == 3) {
child: FutureBuilder( return Container(
future: getFamilyFiles(), // async work decoration: BoxDecoration(
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) { borderRadius: BorderRadius.all(
switch (snapshot.connectionState) { Radius.circular(15),
case ConnectionState.waiting: ),
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading...')); gradient: LinearGradient(
default: colors: isFemale
if (snapshot.hasError) ? [
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); Color(0xFFFBC8CC),
else Color(0xFFFDA4B0),
return checkActive(snapshot.data.getAllSharedRecordsByStatusList) > 0 ]
? ListView.separated( : [
itemBuilder: (context, index) { Color(0xFF7AB8FD),
if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) Color(0xFF6EA8FF),
return Container( ],
margin: EdgeInsets.all(5), begin: Alignment.topRight,
decoration: cardRadius( end: Alignment.bottomLeft,
15, ),
elevation: 0, ),
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), child: Container(
), width: MediaQuery.of(context).size.width,
child: Container( padding: EdgeInsets.all(15),
// height: 130,0xffFDA4B0 child: Row(
width: MediaQuery.of(context).size.width, children: [
padding: EdgeInsets.all(10), Expanded(
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
Column( Text(
crossAxisAlignment: CrossAxisAlignment.start, familySharedRecordsList[index].patientName.toLowerCase().capitalizeFirstofEach,
children: <Widget>[ style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.42),
Texts( ),
snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, Text(
fontSize: 18, TranslationBase.of(context).fileNumber + ': ' + familySharedRecordsList[index].responseID.toString(),
fontWeight: FontWeight.bold, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.4, height: 16 / 10),
color: Colors.white, ),
), Text(
Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), familySharedRecordsList[index].age.toString() + ' ' + TranslationBase.of(context).years + ', ' + familySharedRecordsList[index].genderDescription,
fontSize: 12, color: Colors.white), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.4, height: 16 / 10),
Texts( ),
snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + ],
' ' + ),
TranslationBase.of(context).years + ),
', ' + SizedBox(width: 4),
snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, Column(
fontSize: 12, children: [
color: Colors.white), InkWell(
], onTap: () {
), switchUser(familySharedRecordsList[index], context);
Column( },
children: [ child: Container(
SizedBox(height: 10), decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
InkWell( padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
onTap: () { child: Row(
switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); mainAxisAlignment: MainAxisAlignment.center,
}, children: [
child: Container( SvgPicture.asset("assets/images/new-design/switch.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), SizedBox(width: 4),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10), Texts(TranslationBase.of(context).switchUser, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600)
child: Row( ],
mainAxisAlignment: MainAxisAlignment.center, ),
children: [ ),
SvgPicture.asset("assets/images/new-design/switch.svg", ),
height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), SizedBox(height: 8),
SizedBox( InkWell(
width: 5, onTap: () {
), deleteFamily(familySharedRecordsList[index], context);
// CupertinoSwitch( },
// value: isSwitchUser, child: Container(
// onChanged: (value) { decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
// setState(() { padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
// isSwitchUser = value; child: Row(
// }); mainAxisAlignment: MainAxisAlignment.center,
// if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); children: [
// }, SvgPicture.asset("assets/images/new-design/delete.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
// ), SizedBox(width: 4),
Texts(TranslationBase.of(context).switchUser, Texts(TranslationBase.of(context).delete, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600),
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, ],
fontSize: 12, ),
fontWeight: FontWeight.w600) ),
], ),
))), ],
SizedBox( ),
height: 10, ],
), ),
InkWell( ),
onTap: () { );
deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); } else
}, return SizedBox(height: 0);
child: Container( },
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), separatorBuilder: (context, index) => SizedBox(height: 0),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10), itemCount: familySharedRecordsList.length)
child: Row( : getNoDataWidget(context);
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/images/new-design/delete.svg",
height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white),
SizedBox(
width: 5,
),
Texts(TranslationBase.of(context).delete,
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600),
],
))),
SizedBox(height: 10),
],
),
],
)));
// else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0)
// return getNoDataWidget(context);
else
return SizedBox(height: 0);
},
separatorBuilder: (context, index) => SizedBox(height: 0),
itemCount: snapshot.data.getAllSharedRecordsByStatusList.length)
: getNoDataWidget(context);
}
},
),
),
SizedBox(height: 80.0)
],
));
} }
int checkActive(List<GetAllSharedRecordsByStatusList> list) { int checkActive(List<GetAllSharedRecordsByStatusList> list) {
@ -281,287 +244,175 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
} }
Widget myFamilyRequest(context) { Widget myFamilyRequest(context) {
return //Padding( return ListView(
// padding: const EdgeInsets.symmetric(horizontal: 10.0), children: <Widget>[
// child: SizedBox(height: 21),
SingleChildScrollView( pendingRequestView(),
child: Container( SizedBox(height: 12),
height: MediaQuery.of(context).size.height, sentRequestView(),
margin: EdgeInsets.only(top: 10), SizedBox(height: 12),
child: Column( approvedRequestView(),
children: <Widget>[ ],
FractionallySizedBox( );
widthFactor: 1.0, }
child: AppExpandableNotifier(
title: TranslationBase.of(context).userViewRequest, Widget requestDecoratedContainerWithExpandable(String title, List<Widget> columns, List<Widget> rows) {
bodyWidget: FutureBuilder( return AppExpandableNotifier(
future: getUserViewRequest(), // async work title: title,
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) { bodyWidget: Container(
switch (snapshot.connectionState) { margin: EdgeInsets.only(left: 21, right: 21, bottom: 21),
case ConnectionState.waiting: padding: EdgeInsets.only(top: 12, bottom: 12, left: 14, right: 14),
return SizedBox(); decoration: BoxDecoration(
borderRadius: BorderRadius.all(
default: Radius.circular(10.0),
if (snapshot.hasError) ),
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); border: Border.all(width: 1, color: CustomColors.backgroudGreyColor),
else boxShadow: [
return ListView.separated( BoxShadow(
shrinkWrap: true, color: Color(0xff000000).withOpacity(.05),
physics: NeverScrollableScrollPhysics(), blurRadius: 27,
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), offset: Offset(0, -3),
itemBuilder: (context, _index) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(width: 1, color: Color(0xffEFEFEF)),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white),
child: Column(
children: [
Column(children: [
Padding(
padding: EdgeInsets.all(10),
child: Row(children: [
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)),
Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)),
Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)),
])),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Divider(color: Colors.black, height: 1.5, thickness: 1.5),
),
Column(
children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) {
return Container(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Expanded(
flex: 3,
child: Texts(
result.patientName,
fontWeight: FontWeight.w600,
fontSize: 12,
)),
Expanded(
flex: 1,
child: IconButton(
icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22),
onPressed: () {
acceptRemoveRequest(result.iD, 3, context);
},
)),
Expanded(
flex: 1,
child: IconButton(
icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22),
color: Colors.white,
onPressed: () {
acceptRemoveRequest(result.iD, 4, context);
},
))
],
));
}).toList())
])
],
));
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: 1);
}
},
),
), ),
],
color: Colors.white),
child: Column(children: [
Row(children: columns),
SizedBox(height: 6),
Divider(color: CustomColors.textDarkColor, height: 1, thickness: 1),
SizedBox(height: 8),
ListView.separated(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (cxt, index) => rows[index],
separatorBuilder: (cxt, index) => SizedBox(height: 12),
itemCount: rows.length),
]),
),
);
}
Widget pendingRequestView() {
return requestDecoratedContainerWithExpandable(
TranslationBase.of(context).userViewRequest,
[
Expanded(flex: 3, child: columnText(TranslationBase.of(context).name)),
Expanded(flex: 1, child: columnText(TranslationBase.of(context).allow)),
Expanded(flex: 1, child: columnText(TranslationBase.of(context).reject)),
],
pendingRecordsList.map<Widget>((result) {
return pendingItemView(result);
}).toList());
}
Widget pendingItemView(GetAllSharedRecordsByStatusList result) {
return Row(
children: <Widget>[
Expanded(flex: 3, child: rowText(result.patientName)),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.centerLeft,
child: InkWell(
child: SvgPicture.asset("assets/images/new-design/allow.svg", height: 17),
onTap: () {
acceptRemoveRequest(result.iD, 3, context);
},
), ),
SizedBox(height: 15), ),
FractionallySizedBox( ),
widthFactor: 1.0, Expanded(
child: AppExpandableNotifier( flex: 1,
title: TranslationBase.of(context).sentRequest, child: Align(
bodyWidget: FutureBuilder( alignment: Alignment.centerLeft,
future: getSentRequest(), // async work child: InkWell(
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) { child: SvgPicture.asset("assets/images/new-design/reject.svg", height: 17),
switch (snapshot.connectionState) { onTap: () {
case ConnectionState.waiting: acceptRemoveRequest(result.iD, 4, context);
return SizedBox(); },
default:
if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
else
return ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(width: 1, color: Color(0xffEFEFEF)),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white),
child: Column(
children: [
Padding(
padding: EdgeInsets.all(10),
child: Row(children: [
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)),
Expanded(flex: 1, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600))
])),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Divider(color: Colors.black, height: 1.5, thickness: 1.5),
),
Column(
children: snapshot.data.getAllSharedRecordsByStatusList.map<Widget>((result) {
return Padding(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Expanded(
flex: 3,
child: Texts(
result.patientName,
fontWeight: FontWeight.w600,
fontSize: 12,
)),
Expanded(
flex: 1,
child: Card(
// shape: cardRadius(10),
color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127),
child: Padding(
padding: EdgeInsets.all(5),
child: AppText(
result.statusDescription != null ? result.statusDescription : "",
color: Colors.white,
textAlign: TextAlign.center,
fontSize: 12,
),
),
),
),
],
));
}).toList(),
)
],
));
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: 1,
);
}
}))),
SizedBox(
height: 15,
), ),
FractionallySizedBox( ),
widthFactor: 1.0,
child: AppExpandableNotifier(
title: TranslationBase.of(context).userView,
bodyWidget: FutureBuilder(
future: getUserViewRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text(''));
default:
if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
else
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(width: 1, color: Color(0xffEFEFEF)),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white),
child: Column(
children: [
Column(children: [
Padding(
padding: EdgeInsets.all(10),
child: Row(children: [
Expanded(
flex: 3,
child: AppText(
TranslationBase.of(context).name,
fontWeight: FontWeight.w600,
)),
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(context).delete,
fontWeight: FontWeight.w600,
textAlign: TextAlign.center,
)),
])),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Divider(color: Colors.black, height: 1.5, thickness: 1.5),
),
Column(
children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) {
return Padding(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Expanded(
flex: 3,
child: Texts(
result.patientName,
fontWeight: FontWeight.w600,
fontSize: 12,
)),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(
Icons.delete,
color: Colors.red,
),
onPressed: () {
deactivateRequest(result.iD, 5, context);
},
)),
],
));
}).toList())
])
],
));
}
})))
],
), ),
), ],
);
}
Widget sentRequestView() {
return requestDecoratedContainerWithExpandable(
TranslationBase.of(context).sentRequest,
[
Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)),
Expanded(flex: 2, child: columnText(TranslationBase.of(context).status)),
],
sentRecordsList.map<Widget>((result) {
return sentItemView(result);
}).toList());
}
Widget sentItemView(GetAllSharedRecordsByStatusList result) {
return Row(
children: <Widget>[
Expanded(flex: 2, child: rowText(result.patientName)),
Expanded(
flex: 1,
child: Row(
children: [
Container(
padding: EdgeInsets.only(top: 3, bottom: 3, left: 8, right: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127),
),
child: Text(
result.statusDescription != null ? result.statusDescription : "",
style: TextStyle(
fontSize: 10,
color: Colors.white,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
],
);
}
Widget approvedRequestView() {
return requestDecoratedContainerWithExpandable(
TranslationBase.of(context).userView,
[
Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)),
Expanded(flex: 2, child: columnText(TranslationBase.of(context).delete)),
],
approvedRecordsList.map<Widget>((result) {
return approvedItemView(result);
}).toList());
}
Widget approvedItemView(GetAllSharedRecordsByStatusList result) {
return Row(
children: <Widget>[
Expanded(flex: 4, child: rowText(result.patientName)),
Expanded(
flex: 2,
child: Align(
alignment: Alignment.centerLeft,
child: InkWell(
child: Icon(
Icons.delete,
color: Colors.red,
size: 12,
),
onTap: () {
acceptRemoveRequest(result.iD, 4, context);
},
),
),
),
],
); );
} }
@ -574,24 +425,6 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
} }
} }
Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async {
if (await sharedPref.getObject(FAMILY_FILE) != null) {
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE)));
} else {
return familyFileProvider.getSharedRecordByStatus();
}
}
Future getUserViewRequest() async {
var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserViewRequest(user['PatientID']);
}
Future<GetAllSharedRecordsByStatusResponse> getSentRequest() async {
// var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserSentRequest();
}
deleteFamily(family, context) { deleteFamily(family, context) {
showDialog( showDialog(
context: context, context: context,
@ -629,7 +462,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
// Utils.showProgressDialog(context); // Utils.showProgressDialog(context);
this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) {
print(err); print("err:$err");
AppToast.showErrorToast(message: err.toString()); AppToast.showErrorToast(message: err.toString());
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
@ -662,28 +495,22 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).user = authenticatedUserObject.user; Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).user = authenticatedUserObject.user;
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).setUser(authenticatedUserObject.user); Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).setUser(authenticatedUserObject.user);
appointmentRateViewModel try {
.getIsLastAppointmentRatedList() // await appointmentRateViewModel.getIsLastAppointmentRatedList();
.then((value) => { await getToDoCount();
getToDoCount(), if (appointmentRateViewModel.isHaveAppointmentNotRate) {
GifLoaderDialogUtils.hideDialog(context), Navigator.pushAndRemoveUntil(
if (appointmentRateViewModel.isHaveAppointmentNotRate) context,
{ FadePage(
Navigator.pushAndRemoveUntil( page: RateAppointmentDoctor(),
context, ),
FadePage( (r) => false);
page: RateAppointmentDoctor(), } else {
), Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
(r) => false) }
} } catch (er) {
else
{Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false)}
})
.catchError((err) {
print(err);
// Utils.hideProgressDialog();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}); }
} }
deactivateRequest(ID, status, context) { deactivateRequest(ID, status, context) {
@ -705,24 +532,98 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
checkUserData() async { checkUserData() async {
if (await this.sharedPref.getObject(USER_PROFILE) != null) { if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER));
await getFamilyFiles();
setState(() { setState(() {
this.user = data; this.user = data;
}); });
} }
} }
getToDoCount() { List<GetAllSharedRecordsByStatusList> familySharedRecordsList = [];
List<GetAllSharedRecordsByStatusList> pendingRecordsList = [];
List<GetAllSharedRecordsByStatusList> approvedRecordsList = [];
List<GetAllSharedRecordsByStatusList> sentRecordsList = [];
Future getFamilyFiles() async {
GetAllSharedRecordsByStatusResponse familySharedRecords;
if (await sharedPref.getObject(FAMILY_FILE) != null) {
familySharedRecords = GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE));
}
GifLoaderDialogUtils.showMyDialog(context);
try {
if (familySharedRecords == null) {
familySharedRecords = await familyFileProvider.getSharedRecordByStatus();
}
familySharedRecords.getAllSharedRecordsByStatusList.forEach((element) {
if (element.status == 3) {
familySharedRecordsList.add(element);
}
sentRecordsList.add(element);
});
GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest();
pendingAndApprovedRecords.getAllSharedRecordsByStatusList.forEach((element) {
print(element.toJson());
if (element.status == 2) {
pendingRecordsList.add(element);
} else if (element.status == 3) {
approvedRecordsList.add(element);
}
});
} catch (ex) {
familySharedRecords = GetAllSharedRecordsByStatusResponse(getAllSharedRecordsByStatusList: []);
}
GifLoaderDialogUtils.hideDialog(context);
}
Future getUserViewRequest() async {
var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserViewRequest(user['PatientID']);
}
Future<GetAllSharedRecordsByStatusResponse> getSentRequest() async {
// var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserSentRequest();
}
getToDoCount() async {
toDoProvider.setState(0, true, toDoProvider.notificationsCount); toDoProvider.setState(0, true, toDoProvider.notificationsCount);
ClinicListService service = new ClinicListService(); ClinicListService service = ClinicListService();
service.getActiveAppointmentNo(context).then((res) { try {
var res = await service.getActiveAppointmentNo(context);
print(res['AppointmentActiveNumber']); print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) { if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
} else {} } else {}
}).catchError((err) { } catch (ex) {
print(err); print("getToDoCount:$ex");
}); }
}
Widget columnText(String title) {
return Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 12,
color: CustomColors.textDarkColor,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
);
}
Widget rowText(String title) {
return Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 10,
color: CustomColors.textColor,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
);
} }
} }

@ -70,8 +70,10 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
print("");
initialiseHmgServices(false); initialiseHmgServices(false);
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context); var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
var userProvider = Provider.of<ToDoCountProviderModel>(context);
List<Widget> myMedicalList = Utils.myMedicalListHomePage(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); List<Widget> myMedicalList = Utils.myMedicalListHomePage(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin);
return Container( return Container(
width: double.infinity, width: double.infinity,

@ -75,7 +75,7 @@ class FamilyFilesProvider with ChangeNotifier {
} else } else
return Future.error("No Data"); return Future.error("No Data");
} catch (error) { } catch (error) {
print(error); print("errorerror:$error");
return Future.error(error); return Future.error(error);
} }
} }

@ -14,6 +14,7 @@ class CustomColors {
static const Color lightGreyColor = Color(0xFFE2E2E2); static const Color lightGreyColor = Color(0xFFE2E2E2);
static const Color devider = Color(0xFFE5E5E5); static const Color devider = Color(0xFFE5E5E5);
static const Color darkGreyColor = Color(0xFFC9C9C9); static const Color darkGreyColor = Color(0xFFC9C9C9);
static const Color textDarkColor = Color(0xFF2E303A);
static const Color pharmacyGreyColor = Color(0xFFDBDBDB); static const Color pharmacyGreyColor = Color(0xFFDBDBDB);
static const Color backgroudGreyColor = Color(0xFFEFEFEF); static const Color backgroudGreyColor = Color(0xFFEFEFEF);
static const Color appBackgroudGreyColor = Color(0xFFF7F7F7); static const Color appBackgroudGreyColor = Color(0xFFF7F7F7);

Loading…
Cancel
Save