@ -1,5 +1,6 @@
import ' dart:ui ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/config/size_config.dart ' ;
import ' package:diplomaticquarterapp/core/model/ImagesInfo.dart ' ;
import ' package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart ' ;
@ -7,19 +8,23 @@ import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dar
import ' package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart ' ;
import ' package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart ' ;
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/extensions/string_extensions.dart ' ;
import ' package:diplomaticquarterapp/locator.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.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/FamilyFiles/GetAllSharedRecordByStatusResponse.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart ' ;
import ' package:diplomaticquarterapp/pages/landing/landing_page.dart ' ;
import ' package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart ' ;
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/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_toast.dart ' ;
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/button.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/card/rounded_container.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
@ -28,14 +33,13 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/routes.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart ' ;
class MyFamily extends StatefulWidget {
final bool isAppbarVisible ;
MyFamily ( { this . isAppbarVisible = true } ) ;
@ override
_MyFamily createState ( ) = > _MyFamily ( ) ;
}
@ -55,6 +59,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
PharmacyModuleViewModel pharmacyModuleViewModel = locator < PharmacyModuleViewModel > ( ) ;
ToDoCountProviderModel toDoProvider ;
var isVaiable = false ;
bool isSwitchUser = false ;
@ override
void initState ( ) {
_tabController = new TabController ( length: 2 , vsync: this , initialIndex: 0 ) ;
@ -102,46 +108,64 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
/ / ) ,
/ / ) ,
/ / ) ,
/ / Center (
/ / child: Container (
/ / height: 60.0 ,
/ / / / margin: EdgeInsets . only ( top: 10.0 ) ,
/ / width: MediaQuery . of ( context ) . size . width * 0.92 , / / 0.9 ,
/ / decoration: BoxDecoration (
/ / border: Border (
/ / bottom: BorderSide ( color: Theme . of ( context ) . dividerColor , width: 0.9 ) , / / width: 0.7
/ / ) ,
/ / color: Colors . white ) ,
Center (
child: Container (
height: 60.0 ,
margin: EdgeInsets . only ( top: 10.0 ) ,
width: MediaQuery . of ( context ) . size . width * 0.92 , / / 0.9 ,
decoration: BoxDecoration (
border: Border (
bottom: BorderSide ( color: Theme . of ( context ) . dividerColor , width: 0.9 ) , / / width: 0.7
) ,
color: Colors . white ) ,
child: Center (
child: TabBar (
isScrollable: true ,
controller: _tabController ,
indicatorWeight: 5.0 ,
/ / indicatorSize: TabBarIndicatorSize . label ,
indicatorSize: TabBarIndicatorSize . tab ,
/ / indicatorColor: Theme . of ( context ) . primaryColor ,
/ / labelColor: Theme . of ( context ) . primaryColor ,
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 ) ,
) ,
) ,
] ,
) ,
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 ) ] ,
) ,
) ,
/ / ) ,
/ / ) ,
] ,
) ,
) ,
@ -159,15 +183,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
] ,
) ,
bottomSheet: Container (
width: MediaQuery . of ( context ) . size . width ,
height: 70.0 ,
margin: EdgeInsets . only ( left: 15.0 , right: 15.0 , top: 10.0 ) ,
child: Button (
onTap: ( ) async {
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 ) ;
} ,
label: TranslationBase . of ( context ) . addFamilyMember ,
backgroundColor: Colors . red [ 900 ] ,
) ,
) ,
) ,
@ -195,50 +218,105 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
return Padding (
padding: EdgeInsets . only ( top: 50 ) ,
child: Column ( children: < Widget > [
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: < Widget > [
Expanded (
flex: 3 ,
child: Texts (
TranslationBase . of ( context ) . request ,
textAlign: TextAlign . center ,
) ) ,
Expanded ( flex: 2 , child: Texts ( TranslationBase . of ( context ) . switchUser , textAlign: TextAlign . center ) ) ,
Expanded ( flex: 1 , child: Texts ( TranslationBase . of ( context ) . deleteView , textAlign: TextAlign . center ) ) ,
] ,
) ,
/ / Row (
/ / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
/ / children: < Widget > [
/ / Expanded (
/ / flex: 3 ,
/ / child: Texts (
/ / TranslationBase . of ( context ) . request ,
/ / textAlign: TextAlign . center ,
/ / ) ) ,
/ / Expanded ( flex: 2 , child: Texts ( TranslationBase . of ( context ) . switchUser , textAlign: TextAlign . center ) ) ,
/ / Expanded ( flex: 1 , child: Texts ( TranslationBase . of ( context ) . deleteView , textAlign: TextAlign . center ) ) ,
/ / ] ,
/ / ) ,
Column (
mainAxisAlignment: MainAxisAlignment . start ,
children: snapshot . data . getAllSharedRecordsByStatusList . map < Widget > ( ( result ) {
return result . status = = 3
? Padding (
padding: EdgeInsets . all ( 10 ) ,
child: Row (
children: < Widget > [
Expanded ( flex: 3 , child: Text ( result . patientName ) ) ,
Expanded (
flex: 2 ,
child: IconButton (
icon: Icon ( Icons . group ) ,
color: Colors . black ,
onPressed: ( ) {
switchUser ( result , context ) ;
} ,
) ) ,
Expanded (
flex: 1 ,
child: IconButton (
icon: Icon (
Icons . delete ,
color: Colors . black ,
) ,
onPressed: ( ) {
deleteFamily ( result , context ) ;
} ,
) ) ,
] ,
) )
? Card (
margin: EdgeInsets . all ( 10 ) ,
shape: cardRadius ( 15 ) ,
color: result . gender = = 1 ? Color ( 0xff6EA8FF ) : Color ( 0xffFDA4B0 ) ,
elevation: 3 ,
child: Container (
/ / height: 130 ,
width: MediaQuery . of ( context ) . size . width ,
padding: EdgeInsets . all ( 10 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Texts (
result . patientName . toLowerCase ( ) . capitalizeFirstofEach ,
fontSize: 22 ,
fontWeight: FontWeight . bold ,
color: Colors . white ,
) ,
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 ,
children: [
Row (
children: [
CupertinoSwitch (
value: isSwitchUser ,
onChanged: ( value ) {
setState ( ( ) {
isSwitchUser = value ;
} ) ;
if ( isSwitchUser = = true ) switchUser ( result , context ) ;
} ,
) ,
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 ,
/ / onPressed: ( ) {
/ / switchUser ( result , context ) ;
/ / } ,
/ / ) ) ,
/ / Expanded (
/ / flex: 1 ,
/ / child: IconButton (
/ / icon: Icon (
/ / Icons . delete ,
/ / color: Colors . black ,
/ / ) ,
/ / onPressed: ( ) {
/ / deleteFamily ( result , context ) ;
/ / } ,
/ / ) ) ,
] ,
) ) )
: SizedBox ( ) ;
} ) . toList ( ) )
] ) ) ;
@ -308,35 +386,34 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
] ) ) ,
Column (
children: familyFileProvider . allSharedRecordsByStatusResponse . getAllSharedRecordsByStatusList . map < Widget > ( ( result ) {
return Padding (
padding: EdgeInsets . all ( 10 ) ,
return Card (
child: Row (
children: < Widget > [
Expanded ( flex: 3 , child: Text ( result . patientName ) ) ,
Expanded (
flex: 1 ,
child: IconButton (
icon: Icon (
Icons . check_circle ,
color: Colors . black ,
) ,
onPressed: ( ) {
acceptRemoveRequest ( result . iD , 3 , context ) ;
} ,
) ) ,
Expanded (
flex: 1 ,
child: IconButton (
icon: Icon (
Icons . delete ,
color: Colors . black ,
) ,
onPressed: ( ) {
acceptRemoveRequest ( result . iD , 4 , context ) ;
} ,
) )
] ,
) ) ;
children: < Widget > [
Expanded ( flex: 3 , child: Text ( result . patientName ) ) ,
Expanded (
flex: 1 ,
child: IconButton (
icon: Icon (
Icons . check_circle ,
color: Colors . black ,
) ,
onPressed: ( ) {
acceptRemoveRequest ( result . iD , 3 , context ) ;
} ,
) ) ,
Expanded (
flex: 1 ,
child: IconButton (
icon: Icon (
Icons . delete ,
color: Colors . black ,
) ,
onPressed: ( ) {
acceptRemoveRequest ( result . iD , 4 , context ) ;
} ,
) )
] ,
) ) ;
} ) . toList ( ) )
] )
] ,
@ -525,7 +602,6 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
}
loginAfter ( result , context ) async {
GifLoaderDialogUtils . hideDialog ( context ) ;
var currentLang = await sharedPref . getString ( APP_LANGUAGE ) ;
Provider . of < ProjectViewModel > ( context , listen: false ) . setPrivilege ( privilegeList: result , isLoginChild: true ) ;
result = list . CheckActivationCode . fromJson ( result ) ;
@ -559,7 +635,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
. getIsLastAppointmentRatedList ( )
. then ( ( value ) = > {
getToDoCount ( ) ,
/ / Utils. hide Progress Dialog( ) ,
GifLoaderDialog Utils. hide Dialog( context ) ,
if ( appointmentRateViewModel . isHaveAppointmentNotRate )
{
Navigator . pushAndRemoveUntil (
@ -582,7 +658,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
. catchError ( ( err ) {
print ( err ) ;
/ / Utils . hideProgressDialog ( ) ;
/ / GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
} ) ;
}