Family files fixes

merge-update-with-lab-changes
Haroon Amjad 4 years ago
parent 134ccb7ee1
commit 1fa6a4409b

@ -295,12 +295,12 @@ class GetAllSharedRecordsByStatusList {
int iD; int iD;
int patientID; int patientID;
int responseID; int responseID;
Null relationshipID; dynamic relationshipID;
Null relationship; dynamic relationship;
Null relationshipN; dynamic relationshipN;
int regionID; int regionID;
int status; int status;
Null isActive; dynamic isActive;
String editedOn; String editedOn;
String createdOn; String createdOn;
int age; int age;

@ -12,7 +12,8 @@ import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'
as list;
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
@ -51,12 +52,15 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
var userID; var userID;
TabController _tabController; TabController _tabController;
int _tabIndex = 0; int _tabIndex = 0;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject =
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>(); locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
AuthenticatedUser user; AuthenticatedUser user;
VitalSignService _vitalSignService = locator<VitalSignService>(); VitalSignService _vitalSignService = locator<VitalSignService>();
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>(); PharmacyModuleViewModel pharmacyModuleViewModel =
locator<PharmacyModuleViewModel>();
ToDoCountProviderModel toDoProvider; ToDoCountProviderModel toDoProvider;
var isVaiable = false; var isVaiable = false;
bool isSwitchUser = false; bool isSwitchUser = false;
@ -73,12 +77,18 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Widget build(BuildContext context) { Widget build(BuildContext context) {
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), imageEn:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
); );
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
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);
@ -90,108 +100,56 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
showNewAppBarTitle: true, showNewAppBarTitle: true,
icon: "assets/images/new/bottom_nav/family_files.svg", icon: "assets/images/new/bottom_nav/family_files.svg",
description: TranslationBase.of(context).familyInfo, description: TranslationBase.of(context).familyInfo,
body: Scaffold( body: Column(
extendBodyBehindAppBar: true, children: [
appBar: PreferredSize( TabBar(
preferredSize: Size.fromHeight(65.0), controller: _tabController,
child: Stack( indicatorWeight: 3.0,
children: <Widget>[ indicatorSize: TabBarIndicatorSize.tab,
// Positioned( labelColor: Color(0xff2B353E),
// bottom: 1, unselectedLabelColor: Color(0xff575757),
// left: 0, labelPadding:
// right: 0, EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
// child: BackdropFilter( labelStyle: TextStyle(
// filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
// child: Container( fontSize: 16,
// color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), fontWeight: FontWeight.w600,
// height: 70.0, letterSpacing: -0.48,
// ), ),
// ), unselectedLabelStyle: TextStyle(
// ), fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
// Center( fontSize: 16,
// child: Container( fontWeight: FontWeight.w600,
// height: 60.0, letterSpacing: -0.48,
// // margin: EdgeInsets.only(top: 10.0), ),
// width: MediaQuery.of(context).size.width * 0.92, // 0.9, tabs: [
// decoration: BoxDecoration( Text(TranslationBase.of(context).family),
// border: Border( Text(TranslationBase.of(context).request)
// bottom: BorderSide(color: Theme.of(context).dividerColor, width: 0.9), //width: 0.7
// ),
// color: Colors.white),
Center(
child:
// TabBar(
// isScrollable: true,
// controller: _tabController,
// indicatorWeight: 5.0,
// indicatorSize: TabBarIndicatorSize.tab,
// labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
// unselectedLabelColor: Colors.grey[800],
// tabs: [
// Container(
// width: MediaQuery.of(context).size.width * 0.30,
// child: Center(
// child: AppText(TranslationBase.of(context).family),
// ),
// ),
// Container(
// width: MediaQuery.of(context).size.width * 0.30,
// child: Center(
// child: AppText(TranslationBase.of(context).request),
// ),
// ),
// ],
// ),
TabBar(
controller: _tabController,
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Color(0xff2B353E),
unselectedLabelColor: Color(0xff575757),
labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
tabs: [Text(TranslationBase.of(context).family), Text(TranslationBase.of(context).request)],
),
),
// ),
// ),
], ],
), ),
), Expanded(
body: Column( child: (user != null && projectViewModel.isLogin)
children: <Widget>[ ? TabBarView(
Expanded( physics: BouncingScrollPhysics(),
child: (user != null && projectViewModel.isLogin) controller: _tabController,
? TabBarView( children: [
physics: BouncingScrollPhysics(), myFamilyDetails(context),
controller: _tabController, myFamilyRequest(context)
children: [myFamilyDetails(context), myFamilyRequest(context)], ],
) )
: Container(child: AppText('Loading..')), : Container(child: AppText('Loading..')),
)
],
),
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);
},
), ),
],
),
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);
},
), ),
), ),
); );
@ -199,150 +157,168 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Widget myFamilyDetails(context) { Widget myFamilyDetails(context) {
return Container( return Container(
height: MediaQuery.of(context).size.height, margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0),
margin: EdgeInsets.fromLTRB(20.0, 25.0, 20.0, 0.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 4, flex: 4,
child: FutureBuilder( child: FutureBuilder(
future: getFamilyFiles(), // async work future: getFamilyFiles(), // async work
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) { builder: (BuildContext context,
AsyncSnapshot<GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
else
return Padding( return Padding(
padding: EdgeInsets.only(top: 50), padding: EdgeInsets.all(10),
child: Column(children: <Widget>[ child: Text(
// Row( TranslationBase.of(context).noDataAvailable));
// mainAxisAlignment: MainAxisAlignment.spaceBetween, else
// children: <Widget>[ return ListView.separated(
// Expanded( itemBuilder: (context, index) {
// flex: 3, if (snapshot
// child: Texts( .data
// TranslationBase.of(context).request, .getAllSharedRecordsByStatusList[index]
// textAlign: TextAlign.center, .status ==
// )), 3)
// Expanded(flex: 2, child: Texts(TranslationBase.of(context).switchUser, textAlign: TextAlign.center)), return Card(
// Expanded(flex: 1, child: Texts(TranslationBase.of(context).deleteView, textAlign: TextAlign.center)), margin: EdgeInsets.all(10),
// ], shape: cardRadius(15),
// ), color: snapshot
Column( .data
mainAxisAlignment: MainAxisAlignment.start, .getAllSharedRecordsByStatusList[
children: snapshot.data.getAllSharedRecordsByStatusList.map<Widget>((result) { index]
return result.status == 3 .gender ==
? Card( 1
margin: EdgeInsets.all(10), ? Color(0xff6EA8FF)
shape: cardRadius(15), : Color(0xffFDA4B0),
color: result.gender == 1 ? Color(0xff6EA8FF) : Color(0xffFDA4B0), elevation: 3,
elevation: 3, child: Container(
child: Container( // height: 130,
// height: 130, width:
width: MediaQuery.of(context).size.width, MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
children: <Widget>[ CrossAxisAlignment.start,
children: <Widget>[
Texts(
snapshot
.data
.getAllSharedRecordsByStatusList[
index]
.patientName
.toLowerCase()
.capitalizeFirstofEach,
fontSize: 22,
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),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Row(
children: [
CupertinoSwitch(
value: isSwitchUser,
onChanged: (value) {
setState(() {
isSwitchUser = value;
});
if (isSwitchUser ==
true)
switchUser(
snapshot.data
.getAllSharedRecordsByStatusList[
index],
context);
},
),
Texts( Texts(
result.patientName.toLowerCase().capitalizeFirstofEach, TranslationBase.of(
fontSize: 22, context)
fontWeight: FontWeight.bold, .switchUser,
color: Colors.white, color: Colors.white,
), fontSize: 12,
Texts(TranslationBase.of(context).fileNumber + ': ' + result.responseID.toString(), fontSize: 12, color: Colors.white), )
Texts(result.age.toString() + ' ' + TranslationBase.of(context).years + ', ' + result.genderDescription, fontSize: 12, color: Colors.white), ],
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween, InkWell(
onTap: () {
deleteFamily(
snapshot.data
.getAllSharedRecordsByStatusList[
index],
context);
},
child: Row(
children: [ children: [
Row( Texts(
children: [ TranslationBase.of(
CupertinoSwitch( context)
value: isSwitchUser, .delete,
onChanged: (value) { color: Colors.white,
setState(() { fontSize: 12,
isSwitchUser = value; ),
}); Icon(
if (isSwitchUser == true) switchUser(result, context); Icons.delete,
}, color: Colors.white,
),
Texts(
TranslationBase.of(context).switchUser,
color: Colors.white,
fontSize: 12,
)
],
), ),
InkWell(
onTap: () {
deleteFamily(result, context);
},
child: Row(
children: [
Texts(
TranslationBase.of(context).delete,
color: Colors.white,
fontSize: 12,
),
Icon(
Icons.delete,
color: Colors.white,
),
],
))
], ],
) ))
// Expanded( ],
// flex: 2, )
// child: IconButton( ],
// icon: Icon(Icons.group), )));
// color: Colors.black, else
// onPressed: () { return SizedBox.shrink();
// switchUser(result, context); },
// }, separatorBuilder: (context, index) =>
// )), SizedBox(height: 0),
// Expanded( itemCount: snapshot
// flex: 1, .data.getAllSharedRecordsByStatusList.length);
// child: IconButton(
// icon: Icon(
// Icons.delete,
// color: Colors.black,
// ),
// onPressed: () {
// deleteFamily(result, context);
// },
// )),
],
)))
: SizedBox();
}).toList())
]));
} }
}, },
), ),
), ),
// Expanded( SizedBox(height: 80.0)
// flex: 1,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Row(
// children: <Widget>[
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).addFamilyMember,
// () => {Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE)},
// color: Colors.grey[900],
// textColor: Colors.white,
// ))
// ],
// ),
// ],
// ),
// )
], ],
)); ));
} }
@ -354,25 +330,34 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
SingleChildScrollView( SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
margin: EdgeInsets.only(top: 65), margin: EdgeInsets.only(top: 10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
RoundedContainer( RoundedContainer(
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).userViewRequest, TranslationBase.of(context).userViewRequest,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getUserViewRequest(), // async work future: getUserViewRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) { builder: (BuildContext context,
AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); return Padding(
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -385,27 +370,60 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), Expanded(
Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), flex: 3,
Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), 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)),
])), ])),
Divider(color: Colors.black, height: 1), Divider(
color: Colors.black, height: 1),
Column( Column(
children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) { children: familyFileProvider
.allSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Container( return Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(flex: 3, child: Text(result.patientName)), Expanded(
flex: 3,
child: Text(result
.patientName)),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons.check_circle, Icons
color: Colors.black, .check_circle,
color:
Colors.black,
), ),
onPressed: () { onPressed: () {
acceptRemoveRequest(result.iD, 3, context); acceptRemoveRequest(
result.iD,
3,
context);
}, },
)), )),
Expanded( Expanded(
@ -413,10 +431,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons.delete, Icons.delete,
color: Colors.black, color:
Colors.black,
), ),
onPressed: () { onPressed: () {
acceptRemoveRequest(result.iD, 4, context); acceptRemoveRequest(
result.iD,
4,
context);
}, },
)) ))
], ],
@ -434,18 +456,28 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).sentRequest, TranslationBase.of(context).sentRequest,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getSentRequest(), // async work future: getSentRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) { builder: (BuildContext context,
AsyncSnapshot<GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); return Padding(
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -459,22 +491,45 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded(flex: 3, child: AppText(TranslationBase.of(context).theName, fontWeight: FontWeight.w600)), Expanded(
Expanded(flex: 2, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600)) flex: 3,
child: AppText(
TranslationBase.of(
context)
.theName,
fontWeight:
FontWeight.w600)),
Expanded(
flex: 2,
child: AppText(
TranslationBase.of(
context)
.status,
fontWeight:
FontWeight.w600))
])), ])),
Divider(color: Colors.black, height: 1), Divider(color: Colors.black, height: 1),
Column( Column(
children: snapshot.data.getAllSharedRecordsByStatusList.map<Widget>((result) { children: snapshot.data
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Padding( return Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(flex: 3, child: Text(result.patientName)), Expanded(
flex: 3,
child: Text(result
.patientName)),
Expanded( Expanded(
flex: 2, flex: 2,
child: AppText( child: AppText(
result.statusDescription, result
color: result.status == 3 ? Colors.green : Colors.red, .statusDescription,
color:
result.status == 3
? Colors.green
: Colors.red,
)), )),
], ],
)); ));
@ -490,18 +545,27 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).userView, TranslationBase.of(context).userView,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getUserViewRequest(), // async work future: getUserViewRequest(), // async work
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) { builder: (BuildContext context,
AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); return Padding(
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -514,17 +578,33 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded(flex: 3, child: AppText(TranslationBase.of(context).name)), Expanded(
Expanded(flex: 1, child: AppText(TranslationBase.of(context).delete)), flex: 3,
child: AppText(
TranslationBase.of(
context)
.name)),
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(
context)
.delete)),
])), ])),
Divider(color: Colors.black), Divider(color: Colors.black),
Column( Column(
children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) { children: familyFileProvider
.allSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Padding( return Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(flex: 3, child: AppText(result.patientName)), Expanded(
flex: 3,
child: AppText(result
.patientName)),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
@ -533,7 +613,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
color: Colors.black, color: Colors.black,
), ),
onPressed: () { onPressed: () {
deactivateRequest(result.iD, 5, context); deactivateRequest(
result.iD,
5,
context);
}, },
)), )),
], ],
@ -562,13 +645,11 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
} }
Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async { Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async {
if (user != null) { if (await sharedPref.getObject(FAMILY_FILE) != null) {
if (await sharedPref.getObject(FAMILY_FILE) != null) { return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(
// print(await sharedPref.getObject(FAMILY_FILE)); await sharedPref.getObject(FAMILY_FILE)));
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE))); } else {
} else { return familyFileProvider.getSharedRecordByStatus().then((value) {});
return familyFileProvider.getSharedRecordByStatus();
}
} }
} }
@ -588,7 +669,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
confirmMessage: TranslationBase.of(context).removeFamilyMember, confirmMessage: TranslationBase.of(context).removeFamilyMember,
okText: TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {ConfirmDialog.closeAlertDialog(context), removeFamily(family, context)}, okFunction: () => {
ConfirmDialog.closeAlertDialog(context),
removeFamily(family, context)
},
cancelFunction: () => {}); cancelFunction: () => {});
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
@ -599,7 +683,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request['ID'] = this.userID; request['ID'] = this.userID;
request['IsActive'] = false; request['IsActive'] = false;
this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context)); this
.familyFileProvider
.deativateActivateMemberFile(request)
.then((value) => refreshFamily(context));
} }
refreshFamily(context) { refreshFamily(context) {
@ -617,7 +704,12 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
// .then((value) => loginAfter(value, context)); // .then((value) => loginAfter(value, context));
// 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);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -626,7 +718,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
loginAfter(result, context) async { loginAfter(result, context) async {
var currentLang = await sharedPref.getString(APP_LANGUAGE); var currentLang = await sharedPref.getString(APP_LANGUAGE);
Provider.of<ProjectViewModel>(context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true); Provider.of<ProjectViewModel>(context, listen: false)
.setPrivilege(privilegeList: result, isLoginChild: true);
result = list.CheckActivationCode.fromJson(result); result = list.CheckActivationCode.fromJson(result);
var familyFile = await sharedPref.getObject(FAMILY_FILE); var familyFile = await sharedPref.getObject(FAMILY_FILE);
@ -647,12 +740,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
this.sharedPref.setString(TOKEN, result.authenticationTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID);
await authenticatedUserObject.getUser(getUser: true); await authenticatedUserObject.getUser(getUser: true);
Provider.of<ProjectViewModel>(context, listen: false).user = authenticatedUserObject.user; Provider.of<ProjectViewModel>(context, listen: false).user =
Provider.of<ProjectViewModel>(context, listen: false).setUser(authenticatedUserObject.user); authenticatedUserObject.user;
Provider.of<ProjectViewModel>(context, listen: false)
// await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { .setUser(authenticatedUserObject.user);
// if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser();
// });
appointmentRateViewModel appointmentRateViewModel
.getIsLastAppointmentRatedList() .getIsLastAppointmentRatedList()
@ -690,7 +781,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request["ID"] = ID; request["ID"] = ID;
request["Status"] = status; request["Status"] = status;
this.familyFileProvider.deactivateFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); this.familyFileProvider.deactivateFamily(request).then((value) =>
{GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
} }
acceptRemoveRequest(ID, status, context) { acceptRemoveRequest(ID, status, context) {
@ -698,15 +790,17 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request["ID"] = ID; request["ID"] = ID;
request["Status"] = status; request["Status"] = status;
this.familyFileProvider.acceptRejectFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); this.familyFileProvider.acceptRejectFamily(request).then((value) =>
{GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
} }
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(
print(data2); await this.sharedPref.getObject(MAIN_USER));
setState(() { setState(() {
this.user = data; this.user = data;
}); });
@ -719,7 +813,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
service.getActiveAppointmentNo(context).then((res) { service.getActiveAppointmentNo(context).then((res) {
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) { }).catchError((err) {
print(err); print(err);

@ -37,12 +37,14 @@ class FamilyFilesProvider with ChangeNotifier {
GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse; GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse;
Future<GetAllSharedRecordsByStatusResponse> getSharedRecordByStatus() async { Future<GetAllSharedRecordsByStatusResponse> getSharedRecordByStatus() async {
dynamic localRes;
try { try {
dynamic localRes;
var request = GetAllSharedRecordsByStatusReq(); var request = GetAllSharedRecordsByStatusReq();
var result = await sharedPref.getObject(MAIN_USER); var result = await sharedPref.getObject(MAIN_USER);
request.status = 0; request.status = 0;
request.patientID = result["PatientID"]; request.patientID = result["PatientID"];
await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) {
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {

Loading…
Cancel
Save