my family switch profile improvement.

sikander_family_profile_switch
Sikander Saleem 4 years ago
parent 61d0d52c59
commit fd73c248e2

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

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

@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.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_toast.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'),
);
projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context, listen: false);
return AppScaffold(
appBarTitle: TranslationBase.of(context).myFamilyFiles,
isShowAppBar: widget.isAppbarVisible,
@ -125,155 +126,117 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
)
: 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) {
return Container(
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(
itemBuilder: (context, index) {
if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3)
return Container(
margin: EdgeInsets.all(5),
decoration: cardRadius(
15,
elevation: 0,
color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF),
),
child: Container(
// height: 130,0xffFDA4B0
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach,
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
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),
],
),
Column(
children: [
SizedBox(height: 10),
InkWell(
onTap: () {
switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context);
},
child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10),
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(
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,
),
InkWell(
onTap: () {
deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context);
},
child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(15, 10, 15, 10),
child: Row(
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)
],
));
return (familySharedRecordsList.length ?? 0) > 0
? ListView.separated(
padding: EdgeInsets.all(21),
itemBuilder: (context, index) {
bool isFemale = familySharedRecordsList[index].gender == 2;
if (familySharedRecordsList[index].status == 3) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(15),
),
gradient: LinearGradient(
colors: isFemale
? [
Color(0xFFFBC8CC),
Color(0xFFFDA4B0),
]
: [
Color(0xFF7AB8FD),
Color(0xFF6EA8FF),
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(15),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
familySharedRecordsList[index].patientName.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700, color: isFemale ? Color(0xff5A282E) : Colors.white, letterSpacing: -0.42),
),
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),
),
],
),
),
SizedBox(width: 4),
Column(
children: [
InkWell(
onTap: () {
switchUser(familySharedRecordsList[index], context);
},
child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/images/new-design/switch.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
SizedBox(width: 4),
Texts(TranslationBase.of(context).switchUser, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600)
],
),
),
),
SizedBox(height: 8),
InkWell(
onTap: () {
deleteFamily(familySharedRecordsList[index], context);
},
child: Container(
decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.fromLTRB(10, 8, 12, 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/images/new-design/delete.svg", height: 16, color: isFemale ? Color(0Xff5A282E) : Colors.white),
SizedBox(width: 4),
Texts(TranslationBase.of(context).delete, color: isFemale ? Color(0Xff5A282E) : Colors.white, fontSize: 12, fontWeight: FontWeight.w600),
],
),
),
),
],
),
],
),
),
);
} else
return SizedBox(height: 0);
},
separatorBuilder: (context, index) => SizedBox(height: 0),
itemCount: familySharedRecordsList.length)
: getNoDataWidget(context);
}
int checkActive(List<GetAllSharedRecordsByStatusList> list) {
@ -281,287 +244,175 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
}
Widget myFamilyRequest(context) {
return //Padding(
// 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>[
FractionallySizedBox(
widthFactor: 1.0,
child: AppExpandableNotifier(
title: TranslationBase.of(context).userViewRequest,
bodyWidget: FutureBuilder(
future: getUserViewRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<dynamic> 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: [
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);
}
},
),
return ListView(
children: <Widget>[
SizedBox(height: 21),
pendingRequestView(),
SizedBox(height: 12),
sentRequestView(),
SizedBox(height: 12),
approvedRequestView(),
],
);
}
Widget requestDecoratedContainerWithExpandable(String title, List<Widget> columns, List<Widget> rows) {
return AppExpandableNotifier(
title: title,
bodyWidget: Container(
margin: EdgeInsets.only(left: 21, right: 21, bottom: 21),
padding: EdgeInsets.only(top: 12, bottom: 12, left: 14, right: 14),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(width: 1, color: CustomColors.backgroudGreyColor),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
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,
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(
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,
),
),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.centerLeft,
child: InkWell(
child: SvgPicture.asset("assets/images/new-design/reject.svg", height: 17),
onTap: () {
acceptRemoveRequest(result.iD, 4, context);
},
),
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) {
showDialog(
context: context,
@ -629,7 +462,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
// Utils.showProgressDialog(context);
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());
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).setUser(authenticatedUserObject.user);
appointmentRateViewModel
.getIsLastAppointmentRatedList()
.then((value) => {
getToDoCount(),
GifLoaderDialogUtils.hideDialog(context),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false)
}
else
{Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false)}
})
.catchError((err) {
print(err);
// Utils.hideProgressDialog();
try {
// await appointmentRateViewModel.getIsLastAppointmentRatedList();
await getToDoCount();
if (appointmentRateViewModel.isHaveAppointmentNotRate) {
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false);
} else {
Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
}
} catch (er) {
GifLoaderDialogUtils.hideDialog(context);
});
}
}
deactivateRequest(ID, status, context) {
@ -705,24 +532,98 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
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));
await getFamilyFiles();
setState(() {
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);
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
ClinicListService service = ClinicListService();
try {
var res = await service.getActiveAppointmentNo(context);
print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
} else {}
}).catchError((err) {
print(err);
});
} catch (ex) {
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
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
print("");
initialiseHmgServices(false);
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);
return Container(
width: double.infinity,

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

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

Loading…
Cancel
Save