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,443 +126,293 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
) )
: Container(child: AppText('')), : Container(child: AppText('')),
), ),
], DefaultButton(
),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(14),
child: DefaultButton(
TranslationBase.of(context).addFamilyMember, TranslationBase.of(context).addFamilyMember,
() async { () async {
Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE); Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE);
}, },
), ).insideContainer,
],
), ),
); );
} }
Widget myFamilyDetails(context) { Widget myFamilyDetails(context) {
return Container( return (familySharedRecordsList.length ?? 0) > 0
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
child: Column(
children: <Widget>[
Expanded(
flex: 4,
child: FutureBuilder(
future: getFamilyFiles(), // async work
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading...'));
default:
if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
else
return checkActive(snapshot.data.getAllSharedRecordsByStatusList) > 0
? ListView.separated( ? ListView.separated(
padding: EdgeInsets.all(21),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) bool isFemale = familySharedRecordsList[index].gender == 2;
if (familySharedRecordsList[index].status == 3) {
return Container( return Container(
margin: EdgeInsets.all(5), decoration: BoxDecoration(
decoration: cardRadius( borderRadius: BorderRadius.all(
15, Radius.circular(15),
elevation: 0, ),
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), gradient: LinearGradient(
colors: isFemale
? [
Color(0xFFFBC8CC),
Color(0xFFFDA4B0),
]
: [
Color(0xFF7AB8FD),
Color(0xFF6EA8FF),
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
), ),
child: Container( child: Container(
// height: 130,0xffFDA4B0
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(15),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts( Text(
snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, familySharedRecordsList[index].patientName.toLowerCase().capitalizeFirstofEach,
fontSize: 18, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.42),
fontWeight: FontWeight.bold, ),
color: Colors.white, Text(
TranslationBase.of(context).fileNumber + ': ' + familySharedRecordsList[index].responseID.toString(),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.4, height: 16 / 10),
),
Text(
familySharedRecordsList[index].age.toString() + ' ' + TranslationBase.of(context).years + ', ' + familySharedRecordsList[index].genderDescription,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.4, height: 16 / 10),
), ),
Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(),
fontSize: 12, color: Colors.white),
Texts(
snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() +
' ' +
TranslationBase.of(context).years +
', ' +
snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription,
fontSize: 12,
color: Colors.white),
], ],
), ),
),
SizedBox(width: 4),
Column( Column(
children: [ children: [
SizedBox(height: 10),
InkWell( InkWell(
onTap: () { onTap: () {
switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); switchUser(familySharedRecordsList[index], context);
}, },
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10), padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset("assets/images/new-design/switch.svg", SvgPicture.asset("assets/images/new-design/switch.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), SizedBox(width: 4),
SizedBox( Texts(TranslationBase.of(context).switchUser, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600)
width: 5,
),
// CupertinoSwitch(
// value: isSwitchUser,
// onChanged: (value) {
// setState(() {
// isSwitchUser = value;
// });
// if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context);
// },
// ),
Texts(TranslationBase.of(context).switchUser,
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600)
], ],
))),
SizedBox(
height: 10,
), ),
),
),
SizedBox(height: 8),
InkWell( InkWell(
onTap: () { onTap: () {
deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); deleteFamily(familySharedRecordsList[index], context);
}, },
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10), padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset("assets/images/new-design/delete.svg", SvgPicture.asset("assets/images/new-design/delete.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), SizedBox(width: 4),
SizedBox( Texts(TranslationBase.of(context).delete, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600),
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 } else
return SizedBox(height: 0); return SizedBox(height: 0);
}, },
separatorBuilder: (context, index) => SizedBox(height: 0), separatorBuilder: (context, index) => SizedBox(height: 0),
itemCount: snapshot.data.getAllSharedRecordsByStatusList.length) itemCount: familySharedRecordsList.length)
: getNoDataWidget(context); : getNoDataWidget(context);
} }
},
),
),
SizedBox(height: 80.0)
],
));
}
int checkActive(List<GetAllSharedRecordsByStatusList> list) { int checkActive(List<GetAllSharedRecordsByStatusList> list) {
return list.where((o) => o.status == 3).toList().length; return list.where((o) => o.status == 3).toList().length;
} }
Widget myFamilyRequest(context) { Widget myFamilyRequest(context) {
return //Padding( return ListView(
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child:
SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
margin: EdgeInsets.only(top: 10),
child: Column(
children: <Widget>[ children: <Widget>[
FractionallySizedBox( SizedBox(height: 21),
widthFactor: 1.0, pendingRequestView(),
child: AppExpandableNotifier( SizedBox(height: 12),
title: TranslationBase.of(context).userViewRequest, sentRequestView(),
bodyWidget: FutureBuilder( SizedBox(height: 12),
future: getUserViewRequest(), // async work approvedRequestView(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) { ],
switch (snapshot.connectionState) { );
case ConnectionState.waiting: }
return SizedBox();
Widget requestDecoratedContainerWithExpandable(String title, List<Widget> columns, List<Widget> rows) {
default: return AppExpandableNotifier(
if (snapshot.hasError) title: title,
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); bodyWidget: Container(
else margin: EdgeInsets.only(left: 21, right: 21, bottom: 21),
return ListView.separated( padding: EdgeInsets.only(top: 12, bottom: 12, left: 14, right: 14),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
), ),
border: Border.all(width: 1, color: Color(0xffEFEFEF)), border: Border.all(width: 1, color: CustomColors.backgroudGreyColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Color(0xff000000).withOpacity(.05), color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27, blurRadius: 27,
offset: Offset(0, -3), offset: Offset(0, -3),
), ),
], ],
color: Colors.white), color: Colors.white),
child: Column( child: Column(children: [
children: [ Row(children: columns),
Column(children: [ SizedBox(height: 6),
Padding( Divider(color: CustomColors.textDarkColor, height: 1, thickness: 1),
padding: EdgeInsets.all(10), SizedBox(height: 8),
child: Row(children: [ ListView.separated(
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), physics: NeverScrollableScrollPhysics(),
Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), shrinkWrap: true,
Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), padding: EdgeInsets.zero,
])), itemBuilder: (cxt, index) => rows[index],
Padding( separatorBuilder: (cxt, index) => SizedBox(height: 12),
padding: const EdgeInsets.only(left: 10.0, right: 10.0), itemCount: rows.length),
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), Widget pendingRequestView() {
child: Row( 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>[ children: <Widget>[
Expanded( Expanded(flex: 3, child: rowText(result.patientName)),
flex: 3,
child: Texts(
result.patientName,
fontWeight: FontWeight.w600,
fontSize: 12,
)),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: Align(
icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), alignment: Alignment.centerLeft,
onPressed: () { child: InkWell(
child: SvgPicture.asset("assets/images/new-design/allow.svg", height: 17),
onTap: () {
acceptRemoveRequest(result.iD, 3, context); acceptRemoveRequest(result.iD, 3, context);
}, },
)), ),
),
),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: Align(
icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), alignment: Alignment.centerLeft,
color: Colors.white, child: InkWell(
onPressed: () { child: SvgPicture.asset("assets/images/new-design/reject.svg", height: 17),
onTap: () {
acceptRemoveRequest(result.iD, 4, context); acceptRemoveRequest(result.iD, 4, context);
}, },
))
],
));
}).toList())
])
],
));
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: 1);
}
},
), ),
), ),
), ),
SizedBox(height: 15),
FractionallySizedBox(
widthFactor: 1.0,
child: AppExpandableNotifier(
title: TranslationBase.of(context).sentRequest,
bodyWidget: FutureBuilder(
future: getSentRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
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( Widget sentRequestView() {
padding: EdgeInsets.all(10), return requestDecoratedContainerWithExpandable(
child: Row(children: [ TranslationBase.of(context).sentRequest,
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), [
Expanded(flex: 1, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600)) Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)),
])), Expanded(flex: 2, child: columnText(TranslationBase.of(context).status)),
Padding( ],
padding: const EdgeInsets.only(left: 10.0, right: 10.0), sentRecordsList.map<Widget>((result) {
child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), return sentItemView(result);
), }).toList());
Column( }
children: snapshot.data.getAllSharedRecordsByStatusList.map<Widget>((result) {
return Padding( Widget sentItemView(GetAllSharedRecordsByStatusList result) {
padding: EdgeInsets.all(10), return Row(
child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(flex: 2, child: rowText(result.patientName)),
flex: 3,
child: Texts(
result.patientName,
fontWeight: FontWeight.w600,
fontSize: 12,
)),
Expanded( Expanded(
flex: 1, flex: 1,
child: Card( child: Row(
// shape: cardRadius(10), 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), color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127),
child: Padding( ),
padding: EdgeInsets.all(5), child: Text(
child: AppText(
result.statusDescription != null ? result.statusDescription : "", result.statusDescription != null ? result.statusDescription : "",
style: TextStyle(
fontSize: 10,
color: Colors.white, color: Colors.white,
textAlign: TextAlign.center, letterSpacing: -0.4,
fontSize: 12, fontWeight: FontWeight.w600,
),
), ),
), ),
), ),
], ],
)); ),
}).toList(), ),
)
], ],
));
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: 1,
); );
} }
}))),
SizedBox( Widget approvedRequestView() {
height: 15, return requestDecoratedContainerWithExpandable(
), TranslationBase.of(context).userView,
FractionallySizedBox( [
widthFactor: 1.0, Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)),
child: AppExpandableNotifier( Expanded(flex: 2, child: columnText(TranslationBase.of(context).delete)),
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), approvedRecordsList.map<Widget>((result) {
child: Column( return approvedItemView(result);
children: [ }).toList());
Column(children: [ }
Padding(
padding: EdgeInsets.all(10), Widget approvedItemView(GetAllSharedRecordsByStatusList result) {
child: Row(children: [ return Row(
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>[ children: <Widget>[
Expanded(flex: 4, child: rowText(result.patientName)),
Expanded( Expanded(
flex: 3, flex: 2,
child: Texts( child: Align(
result.patientName, alignment: Alignment.centerLeft,
fontWeight: FontWeight.w600, child: InkWell(
fontSize: 12, child: Icon(
)),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(
Icons.delete, Icons.delete,
color: Colors.red, color: Colors.red,
size: 12,
), ),
onPressed: () { onTap: () {
deactivateRequest(result.iD, 5, context); acceptRemoveRequest(result.iD, 4, context);
}, },
)),
],
));
}).toList())
])
],
));
}
})))
],
), ),
), ),
),
],
); );
} }
@ -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),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
FadePage( FadePage(
page: RateAppointmentDoctor(), page: RateAppointmentDoctor(),
), ),
(r) => false) (r) => false);
} else {
Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
} }
else } catch (er) {
{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