@ -1,178 +1,351 @@
import ' package:diplomaticquarterapp/config/size_config.dart ' ;
import ' package:diplomaticquarterapp/config/size_config.dart ' ;
import ' package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart ' ;
import ' package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart ' ;
import ' package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart ' ;
import ' package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart ' ;
import ' package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart ' ;
import ' package:diplomaticquarterapp/services/family_files/family_files_provider.dart ' ;
import ' package:diplomaticquarterapp/services/family_files/family_files_provider.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils.dart ' ;
import ' package:diplomaticquarterapp/widgets/card/rounded_container.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/bottom_bar.dart ' ;
import ' package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart ' ;
import ' package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart ' ;
import ' package:diplomaticquarterapp/widgets/text/app_texts_widget.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/routes.dart ' ;
import ' package:diplomaticquarterapp/routes.dart ' ;
class MyFamily extends StatelessWidget {
class MyFamily extends StatefulWidget {
/ / bool isLoading = true ;
@ override
_MyFamily createState ( ) = > _MyFamily ( ) ;
}
class _MyFamily extends State < MyFamily > with TickerProviderStateMixin {
final familyFileProvider = FamilyFilesProvider ( ) ;
final familyFileProvider = FamilyFilesProvider ( ) ;
AppSharedPreferences sharedPref = new AppSharedPreferences ( ) ;
AppSharedPreferences sharedPref = new AppSharedPreferences ( ) ;
var userID ;
var userID ;
TabController _tabController ;
@ override
void initState ( ) {
_tabController = new TabController ( length: 2 , vsync: this , initialIndex: 0 ) ;
super . initState ( ) ;
}
bool expandFlag = false ;
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return AppScaffold (
return Scaffold (
appBarTitle: TranslationBase . of ( context ) . myFamilyFiles ,
appBar: AppBar (
isShowAppBar: true ,
bottom: TabBar (
body: DefaultTabController (
indicatorColor: Colors . red ,
length: 2 ,
tabs: [
child: SingleChildScrollView (
Padding (
padding: EdgeInsets . all ( 20 ) ,
padding: EdgeInsets . all ( 6 ) ,
child: Container (
child: AppText (
height: SizeConfig . realScreenHeight ,
TranslationBase . of ( context ) . family ,
width: SizeConfig . realScreenWidth ,
color: Colors . white ,
child: Stack (
) ) ,
children: < Widget > [
Padding (
TabBar (
padding: EdgeInsets . all ( 6 ) ,
indicatorColor: Colors . red ,
child: AppText (
tabs: [
TranslationBase . of ( context ) . request ,
Padding (
color: Colors . white ,
padding: EdgeInsets . all ( 6 ) ,
) ) ,
child:
] ,
Text ( TranslationBase . of ( context ) . family ) ) ,
controller: _tabController ,
Padding (
) ,
padding: EdgeInsets . all ( 6 ) ,
title: AppText ( TranslationBase . of ( context ) . myFamilyFiles ,
child:
color: Colors . white ) ) ,
Text ( TranslationBase . of ( context ) . request ) ) ,
body: TabBarView (
] ,
/ / physics: NeverScrollableScrollPhysics ( ) ,
) ,
children: [ myFamilyDetails ( context ) , myFamilyRequest ( context ) ] ,
TabBarView (
controller: _tabController ) ,
children: [
bottomNavigationBar: BottomBarSearch ( ) ) ;
myFamilyDetails ( context ) ,
myFamilyRequest ( context )
/ / AppScaffold (
] ,
/ / appBarTitle: TranslationBase . of ( context ) . myFamilyFiles ,
)
/ / isShowAppBar: true ,
] ,
/ / body: SingleChildScrollView (
) ) ) ) ) ;
/ / child: Container (
/ / height: SizeConfig . screenHeight ,
/ / width: SizeConfig . realScreenWidth ,
/ / padding: EdgeInsets . all ( 20 ) ,
/ / child: Stack (
/ / children: < Widget > [
/ / TabBar (
/ / controller: _tabController ,
/ / indicatorColor: Colors . red ,
/ / tabs: [
/ / Padding (
/ / padding: EdgeInsets . all ( 6 ) ,
/ / child: Text ( TranslationBase . of ( context ) . family ) ) ,
/ / Padding (
/ / padding: EdgeInsets . all ( 6 ) ,
/ / child: Text ( TranslationBase . of ( context ) . request ) ) ,
/ / ] ,
/ / ) ,
/ / TabBarView (
/ / controller: _tabController ,
/ / children: [
/ / myFamilyDetails ( context ) ,
/ / myFamilyRequest ( context )
/ / ] ,
/ / )
/ / ] ,
/ / ) ) ) ) ;
}
}
Widget myFamilyDetails ( context ) {
Widget myFamilyDetails ( context ) {
return / / Padding (
return Container (
/ / padding: EdgeInsets . only ( top: 50 ) ,
height: MediaQuery . of ( context ) . size . height ,
/ / child:
margin: EdgeInsets . fromLTRB ( 20.0 , 0 , 20.0 , 0.0 ) ,
Column (
child: Column (
/ / mainAxisAlignment: MainAxisAlignment . start ,
children: < Widget > [
children: < Widget > [
Expanded (
Expanded (
flex: 1 ,
flex: 3 ,
child: FutureBuilder (
child: FutureBuilder (
future: getFamilyFiles ( ) , / / async work
future: getFamilyFiles ( ) , / / async work
builder: ( BuildContext context ,
builder: ( BuildContext context ,
AsyncSnapshot < GetAllSharedRecordsByStatusResponse >
AsyncSnapshot < GetAllSharedRecordsByStatusResponse > snapshot ) {
snapshot ) {
switch ( snapshot . connectionState ) {
switch ( snapshot . connectionState ) {
case ConnectionState . waiting:
case ConnectionState . waiting:
return Padding (
return Padding (
padding: EdgeInsets . only ( top: 50 ) ,
padding: EdgeInsets . only ( top: 50 ) ,
child: Text ( ' Loading.... ' ) ) ;
child: Text ( ' Loading.... ' ) ) ;
default :
default :
if ( snapshot . hasError )
if ( snapshot . hasError )
return Padding (
return Padding (
padding: EdgeInsets . all ( 10 ) ,
padding: EdgeInsets . all ( 10 ) ,
child: Text ( snapshot . error ) ) ;
child: Text ( snapshot . error ) ) ;
else
else
return Padding (
return Padding (
padding: EdgeInsets . only ( top: 50 ) ,
padding: EdgeInsets . only ( top: 50 ) ,
child: Column ( children: < Widget > [
child: Column ( children: < Widget > [
Row (
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
mainAxisAlignment:
children: < Widget > [
MainAxisAlignment . spaceBetween ,
Expanded (
children: < Widget > [
flex: 3 ,
Expanded (
child: Text (
flex: 3 ,
TranslationBase . of ( context ) . request ) ) ,
child: Text ( TranslationBase . of ( context )
Expanded (
. request ) ) ,
flex: 2 ,
Expanded (
child: Text (
flex: 2 ,
TranslationBase . of ( context ) . switchUser ,
child: Text (
) ) ,
TranslationBase . of ( context )
Expanded (
. switchUser ,
flex: 1 ,
) ) ,
child: Text (
Expanded (
TranslationBase . of ( context ) . deleteView ,
flex: 1 ,
) ) ,
child: Text (
] ,
TranslationBase . of ( context )
) ,
. deleteView ,
Column (
) ) ,
mainAxisAlignment: MainAxisAlignment . start ,
] ,
children: snapshot
) ,
. data . getAllSharedRecordsByStatusList
Column (
. map < Widget > ( ( result ) {
mainAxisAlignment: MainAxisAlignment . start ,
return result . status = = 3
children: snapshot
? Padding (
. data . getAllSharedRecordsByStatusList
padding: EdgeInsets . all ( 10 ) ,
. map < Widget > ( ( result ) {
child: Row (
return result . status = = 3
children: < Widget > [
? Padding (
Expanded (
padding: EdgeInsets . all ( 10 ) ,
flex: 3 ,
child: Row (
child:
children: < Widget > [
Text ( result . patientName ) ) ,
Expanded (
Expanded (
flex: 3 ,
flex: 2 ,
child: Text (
child: IconButton (
result . patientName ) ) ,
icon: Icon ( Icons . group ) ,
Expanded (
color: Colors . black ,
flex: 2 ,
onPressed: ( ) {
child: IconButton (
switchUser (
icon: Icon ( Icons . group ) ,
result , context ) ;
color: Colors . black ,
} ,
onPressed: ( ) {
) ) ,
switchUser (
Expanded (
result , context ) ;
flex: 1 ,
} ,
child: IconButton (
) ) ,
icon: Icon (
Expanded (
Icons . delete ,
flex: 1 ,
color: Colors . black ,
child: IconButton (
) ,
icon: Icon (
onPressed: ( ) {
Icons . delete ,
deleteFamily (
color: Colors . black ,
result , context ) ;
) ,
} ,
onPressed: ( ) {
) ) ,
deleteFamily (
] ,
result , context ) ;
) )
} ,
: SizedBox ( ) ;
) ) ,
} ) . toList ( ) )
] ,
] ) ) ;
) )
}
: SizedBox ( ) ;
} ,
} ) . toList ( ) )
) ) ,
] ) ) ;
Expanded (
}
flex: 1 ,
} ,
child: Column (
) ) ,
children: < Widget > [
Expanded (
Row (
flex: 1 ,
child: Column (
mainAxisAlignment: MainAxisAlignment . end ,
children: < Widget > [
children: < Widget > [
Expanded (
Row (
child: DefaultButton (
children: < Widget > [
TranslationBase . of ( context ) . addFamilyMember ,
Expanded (
( ) = > {
child: DefaultButton (
Navigator . of ( context ) . pushNamed ( ADD_FAMILY_MEMBER_TYPE )
TranslationBase . of ( context ) . addFamilyMember ,
} ,
( ) = > {
color: Colors . grey [ 900 ] ,
Navigator . of ( context )
textColor: Colors . white ,
. pushNamed ( ADD_FAMILY_MEMBER_TYPE )
) )
} ,
color: Colors . grey [ 900 ] ,
textColor: Colors . white ,
) )
] ,
) ,
] ,
] ,
) ,
) )
] ,
] ,
) )
) ) ;
] ,
) ;
}
}
addMember ( ) { }
Widget myFamilyRequest ( context ) {
Widget myFamilyRequest ( context ) {
return Column (
return Padding (
children: < Widget > [ ] ,
padding: const EdgeInsets . symmetric ( horizontal: 10.0 ) ,
child: Column (
children: < Widget > [
/ / SizedBox ( height: 20.0 ) ,
RoundedContainer (
child: ExpansionTile (
title: Text (
TranslationBase . of ( context ) . userViewRequest ,
style: TextStyle ( fontSize: 18.0 , fontWeight: FontWeight . bold ) ,
) ,
children: < Widget > [
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 ( ' Loading.... ' ) ) ;
default :
if ( snapshot . hasError )
return Padding (
padding: EdgeInsets . all ( 10 ) ,
child: Text ( snapshot . error ) ) ;
else
return Column (
children: [
Row (
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
children: < Widget > [
Expanded (
flex: 3 ,
child: Text ( TranslationBase . of ( context )
. request ) ) ,
Expanded (
flex: 2 ,
child: Text (
TranslationBase . of ( context )
. switchUser ,
) ) ,
Expanded (
flex: 1 ,
child: Text (
TranslationBase . of ( context )
. deleteView ,
) ) ,
] ,
) ,
Column (
children: [ ] ,
)
] ,
) ;
}
} )
] ,
) ,
) ,
RoundedContainer (
child: ExpansionTile (
title: Text (
TranslationBase . of ( context ) . sentRequest ,
style: TextStyle ( fontSize: 18.0 , fontWeight: FontWeight . bold ) ,
) ,
children: < Widget > [
FutureBuilder (
future: getSentRequest ( ) , / / async work
builder:
( BuildContext context , AsyncSnapshot < dynamic > 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 ( snapshot . error ) ) ;
else
return Column (
children: [
Row (
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
children: < Widget > [
Expanded (
flex: 3 ,
child: Text (
TranslationBase . of ( context ) . request ) ) ,
Expanded (
flex: 2 ,
child: Text (
TranslationBase . of ( context ) . switchUser ,
) ) ,
Expanded (
flex: 1 ,
child: Text (
TranslationBase . of ( context ) . deleteView ,
) ) ,
] ,
) ,
Column (
children: [ ] ,
)
] ,
) ;
}
} )
] ,
) ) ,
RoundedContainer (
child: ExpansionTile (
title: Text (
TranslationBase . of ( context ) . userView ,
style: TextStyle ( fontSize: 18.0 , fontWeight: FontWeight . bold ) ,
) ,
children: < Widget > [
ListTile (
title: Text ( ' data ' ) ,
)
] ,
) )
] ,
) ,
) ;
) ;
}
}
@ -186,6 +359,16 @@ class MyFamily extends StatelessWidget {
}
}
}
}
Future getUserViewRequest ( ) async {
var user = await sharedPref . getObject ( USER_PROFILE ) ;
return familyFileProvider . getUserViewRequest ( user [ ' PatientID ' ] ) ;
}
Future getSentRequest ( ) async {
/ / var user = await sharedPref . getObject ( USER_PROFILE ) ;
return familyFileProvider . getUserSentRequest ( ) ;
}
deleteFamily ( family , context ) {
deleteFamily ( family , context ) {
ConfirmDialog dialog = new ConfirmDialog (
ConfirmDialog dialog = new ConfirmDialog (
context: context ,
context: context ,