@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart';
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/StarRating.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/floating_button_search.dart ' ;
@ -50,6 +51,7 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
var _currentLocaleId ;
stt . SpeechToText speech = stt . SpeechToText ( ) ;
var reconizedWord ;
int selectedStatusIndex = 5 ;
var event = RobotProvider ( ) ;
List < AppoitmentAllHistoryResultList > appoList = [ ] ;
@ -165,16 +167,16 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
} ) ;
} ,
child: DoctorCard (
onTap: null ,
isInOutPatient: appointHistory . isInOutPatient ,
name: appointHistory . doctorTitle + " " + appointHistory . doctorNameObj ,
/ / billNo: _appointmentResult . invoiceNo ,
profileUrl: appointHistory . doctorImageURL ,
subName: appointHistory . projectName ,
isLiveCareAppointment: appointHistory . isLiveCareAppointment ,
date: DateUtil . convertStringToDate ( appointHistory . appointmentDate ) ,
rating: appointHistory . actualDoctorRate + 0.0 ,
appointmentTime: appointHistory . startTime . substring ( 0 , 5 ) ,
onTap: null ,
isInOutPatient: appointHistory . isInOutPatient ,
name: appointHistory . doctorTitle + " " + appointHistory . doctorNameObj ,
/ / billNo: _appointmentResult . invoiceNo ,
profileUrl: appointHistory . doctorImageURL ,
subName: appointHistory . projectName ,
isLiveCareAppointment: appointHistory . isLiveCareAppointment ,
date: DateUtil . convertStringToDate ( appointHistory . appointmentDate ) ,
rating: appointHistory . actualDoctorRate + 0.0 ,
appointmentTime: appointHistory . startTime . substring ( 0 , 5 ) ,
) ,
) ,
SizedBox ( height: 12 ) ,
@ -182,8 +184,9 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
Container (
margin: EdgeInsets . only ( bottom: 10.0 ) ,
height: appoList . length > 2 ? MediaQuery . of ( context ) . size . height * 0.35 : MediaQuery . of ( context ) . size . height * 0.17 ,
child: ListView . builder (
child: ListView . separated (
itemCount: appoList . length ,
separatorBuilder: ( ctx , index ) = > SizedBox ( height: 12 ) ,
itemBuilder: ( context , index ) = > InkWell (
onTap: ( ) {
setState ( ( ) {
@ -309,6 +312,7 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
messageController . text = " " ;
images = [ ] ;
} ) ;
selectedStatusIndex = 5 ;
setMessageType ( MessageType . NON ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showSuccessToast ( message: TranslationBase . of ( context ) . yourFeedback ) ;
@ -429,42 +433,107 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
/ / Show Dialog function
void confirmBox ( FeedbackViewModel model ) {
DoctorsListService service = new DoctorsListService ( ) ;
List < RadioSelectionDialogModel > list = [
RadioSelectionDialogModel ( TranslationBase . of ( context ) . notClassified , 5 ) ,
RadioSelectionDialogModel ( TranslationBase . of ( context ) . complainAppo , 1 ) ,
RadioSelectionDialogModel ( TranslationBase . of ( context ) . complainWithoutAppo , 2 ) ,
RadioSelectionDialogModel ( TranslationBase . of ( context ) . question , 3 ) ,
RadioSelectionDialogModel ( TranslationBase . of ( context ) . compliment , 4 ) ,
RadioSelectionDialogModel ( TranslationBase . of ( context ) . suggestion , 6 ) ,
] ;
showDialog (
context: context ,
child: FeedbackTypeDialog (
messageTypeDialog: messageType ,
onValueSelected: ( MessageType value ) {
if ( value = = MessageType . ComplaintOnAnAppointment ) {
appoList . clear ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getPatientAppointmentHistory ( false , context , isForCOC: true ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
setState ( ( ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' AppoimentAllHistoryResultList ' ] . length ! = 0 ) {
res [ ' AppoimentAllHistoryResultList ' ] . forEach ( ( v ) {
appoList . add ( new AppoitmentAllHistoryResultList . fromJson ( v ) ) ;
} ) ;
setState ( ( ) {
appointHistory = null ;
isShowListAppointHistory = true ;
} ) ;
} else { }
} else {
}
} ) ;
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
/ / print ( err ) ;
/ / AppToast . showErrorToast ( message: err ) ;
/ / Navigator . of ( context ) . pop ( ) ;
context: context ,
child: RadioSelectionDialog (
listData: list ,
selectedIndex: selectedStatusIndex ,
onValueSelected: ( index ) {
selectedStatusIndex = index ;
if ( index = = 1 ) {
messageType = MessageType . ComplaintOnAnAppointment ;
} else if ( index = = 2 ) {
messageType = MessageType . ComplaintWithoutAppointment ;
} else if ( index = = 3 ) {
messageType = MessageType . Question ;
} else if ( index = = 4 ) {
messageType = MessageType . Compliment ;
} else if ( index = = 5 ) {
messageType = MessageType . NON ;
} else {
messageType = MessageType . Suggestion ;
}
if ( messageType = = MessageType . ComplaintOnAnAppointment ) {
appoList . clear ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getPatientAppointmentHistory ( false , context , isForCOC: true ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
setState ( ( ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' AppoimentAllHistoryResultList ' ] . length ! = 0 ) {
res [ ' AppoimentAllHistoryResultList ' ] . forEach ( ( v ) {
appoList . add ( new AppoitmentAllHistoryResultList . fromJson ( v ) ) ;
} ) ;
setState ( ( ) {
appointHistory = null ;
isShowListAppointHistory = true ;
} ) ;
} else { }
} else { }
} ) ;
} else {
isShowListAppointHistory = false ;
}
setMessageType ( value ) ;
} ,
) ) ;
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
/ / print ( err ) ;
/ / AppToast . showErrorToast ( message: err ) ;
/ / Navigator . of ( context ) . pop ( ) ;
} ) ;
} else {
isShowListAppointHistory = false ;
}
setMessageType ( messageType ) ;
} ,
) ,
) ;
return ;
/ / todo ' sikander ' remove useless code
/ / showDialog (
/ / context: context ,
/ / child: FeedbackTypeDialog (
/ / messageTypeDialog: messageType ,
/ / onValueSelected: ( MessageType value ) {
/ / if ( value = = MessageType . ComplaintOnAnAppointment ) {
/ / appoList . clear ( ) ;
/ / GifLoaderDialogUtils . showMyDialog ( context ) ;
/ / service . getPatientAppointmentHistory ( false , context , isForCOC: true ) . then ( ( res ) {
/ / GifLoaderDialogUtils . hideDialog ( context ) ;
/ / setState ( ( ) {
/ / if ( res [ ' MessageStatus ' ] = = 1 ) {
/ / if ( res [ ' AppoimentAllHistoryResultList ' ] . length ! = 0 ) {
/ / res [ ' AppoimentAllHistoryResultList ' ] . forEach ( ( v ) {
/ / appoList . add ( new AppoitmentAllHistoryResultList . fromJson ( v ) ) ;
/ / } ) ;
/ / setState ( ( ) {
/ / appointHistory = null ;
/ / isShowListAppointHistory = true ;
/ / } ) ;
/ / } else { }
/ / } else { }
/ / } ) ;
/ / } ) . catchError ( ( err ) {
/ / GifLoaderDialogUtils . hideDialog ( context ) ;
/ / / / print ( err ) ;
/ / / / AppToast . showErrorToast ( message: err ) ;
/ / / / Navigator . of ( context ) . pop ( ) ;
/ / } ) ;
/ / } else {
/ / isShowListAppointHistory = false ;
/ / }
/ / setMessageType ( value ) ;
/ / } ,
/ / ) ) ;
}
openSpeechReco ( ) async {
@ -518,238 +587,238 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
if ( ! mounted ) return ;
}
}
class FeedbackTypeDialog extends StatefulWidget {
final Function ( MessageType ) onValueSelected ;
final MessageType messageTypeDialog ;
const FeedbackTypeDialog ( { Key key , this . onValueSelected , this . messageTypeDialog = MessageType . NON } ) : super ( key: key ) ;
@ override
State createState ( ) = > new FeedbackTypeDialogState ( ) ;
}
class FeedbackTypeDialogState extends State < FeedbackTypeDialog > {
MessageType messageTypeDialog = MessageType . NON ;
setMessageDialogType ( MessageType messageType ) {
setState ( ( ) {
messageTypeDialog = messageType ;
} ) ;
}
@ override
void initState ( ) {
messageTypeDialog = widget . messageTypeDialog ;
super . initState ( ) ;
}
Widget build ( BuildContext context ) {
return BaseView < FeedbackViewModel > (
builder: ( _ , model , widge ) = > SimpleDialog (
title: Text (
TranslationBase . of ( context ) . messageType ,
textAlign: TextAlign . center ,
) ,
children: < Widget > [
Container (
/ / padding: const EdgeInsets . all ( 10.0 ) ,
child: Column (
children: < Widget > [
Divider (
height: 2.5 ,
color: Colors . grey [ 500 ] ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . NON ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . notClassified ) ,
leading: Radio (
value: MessageType . NON ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . ComplaintOnAnAppointment ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . complainAppo ) ,
leading: Radio (
value: MessageType . ComplaintOnAnAppointment ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . ComplaintWithoutAppointment ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . complainWithoutAppo ) ,
leading: Radio (
value: MessageType . ComplaintWithoutAppointment ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . Question ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . question ) ,
leading: Radio (
value: MessageType . Question ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . Compliment ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . compliment ) ,
leading: Radio (
value: MessageType . Compliment ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Row (
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) = > setMessageDialogType ( MessageType . Suggestion ) ,
child: ListTile (
title: Texts ( TranslationBase . of ( context ) . suggestion ) ,
leading: Radio (
value: MessageType . Suggestion ,
groupValue: messageTypeDialog ,
activeColor: CustomColors . accentColor ,
onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 5.0 ,
) ,
Divider (
height: 2.5 ,
color: Colors . grey [ 500 ] ,
) ,
SizedBox (
height: 5 ,
) ,
Row (
/ / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: < Widget > [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . pop ( context ) ;
} ,
child: Padding (
padding: EdgeInsets . all ( 8.0 ) ,
child: Container (
child: Center (
child: Texts (
TranslationBase . of ( context ) . cancel ,
color: CustomColors . accentColor ,
) ,
) ,
) ,
) ,
) ,
) ,
Container (
width: 1 ,
height: 30 ,
color: Colors . grey [ 500 ] ,
) ,
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
widget . onValueSelected ( messageTypeDialog ) ;
Navigator . pop ( context ) ;
} ,
child: Padding (
padding: const EdgeInsets . all ( 8.0 ) ,
child: Center (
child: Texts (
TranslationBase . of ( context ) . ok ,
fontWeight: FontWeight . w400 ,
) ) ,
) ,
) ) ,
] ,
)
] ,
) ,
) ,
] ,
) ,
) ;
}
}
/ / todo ' sikander ' remove useless code
/ / class FeedbackTypeDialog extends StatefulWidget {
/ / final Function ( MessageType ) onValueSelected ;
/ / final MessageType messageTypeDialog ;
/ /
/ / const FeedbackTypeDialog ( { Key key , this . onValueSelected , this . messageTypeDialog = MessageType . NON } ) : super ( key: key ) ;
/ /
/ / @ override
/ / State createState ( ) = > new FeedbackTypeDialogState ( ) ;
/ / }
/ /
/ / class FeedbackTypeDialogState extends State < FeedbackTypeDialog > {
/ / MessageType messageTypeDialog = MessageType . NON ;
/ /
/ / setMessageDialogType ( MessageType messageType ) {
/ / setState ( ( ) {
/ / messageTypeDialog = messageType ;
/ / } ) ;
/ / }
/ /
/ / @ override
/ / void initState ( ) {
/ / messageTypeDialog = widget . messageTypeDialog ;
/ /
/ / super . initState ( ) ;
/ / }
/ /
/ / Widget build ( BuildContext context ) {
/ / return BaseView < FeedbackViewModel > (
/ / builder: ( _ , model , widge ) = > SimpleDialog (
/ / title: Text (
/ / TranslationBase . of ( context ) . messageType ,
/ / textAlign: TextAlign . center ,
/ / ) ,
/ / children: < Widget > [
/ / Container (
/ / / / padding: const EdgeInsets . all ( 10.0 ) ,
/ / child: Column (
/ / children: < Widget > [
/ / Divider (
/ / height: 2.5 ,
/ / color: Colors . grey [ 500 ] ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . NON ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . notClassified ) ,
/ / leading: Radio (
/ / value: MessageType . NON ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . ComplaintOnAnAppointment ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . complainAppo ) ,
/ / leading: Radio (
/ / value: MessageType . ComplaintOnAnAppointment ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . ComplaintWithoutAppointment ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . complainWithoutAppo ) ,
/ / leading: Radio (
/ / value: MessageType . ComplaintWithoutAppointment ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . Question ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . question ) ,
/ / leading: Radio (
/ / value: MessageType . Question ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . Compliment ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . compliment ) ,
/ / leading: Radio (
/ / value: MessageType . Compliment ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Row (
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) = > setMessageDialogType ( MessageType . Suggestion ) ,
/ / child: ListTile (
/ / title: Texts ( TranslationBase . of ( context ) . suggestion ) ,
/ / leading: Radio (
/ / value: MessageType . Suggestion ,
/ / groupValue: messageTypeDialog ,
/ / activeColor: CustomColors . accentColor ,
/ / onChanged: ( MessageType value ) = > setMessageDialogType ( value ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5.0 ,
/ / ) ,
/ / Divider (
/ / height: 2.5 ,
/ / color: Colors . grey [ 500 ] ,
/ / ) ,
/ / SizedBox (
/ / height: 5 ,
/ / ) ,
/ / Row (
/ / / / mainAxisAlignment: MainAxisAlignment . spaceBetween ,
/ / children: < Widget > [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . pop ( context ) ;
/ / } ,
/ / child: Padding (
/ / padding: EdgeInsets . all ( 8.0 ) ,
/ / child: Container (
/ / child: Center (
/ / child: Texts (
/ / TranslationBase . of ( context ) . cancel ,
/ / color: CustomColors . accentColor ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / Container (
/ / width: 1 ,
/ / height: 30 ,
/ / color: Colors . grey [ 500 ] ,
/ / ) ,
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / widget . onValueSelected ( messageTypeDialog ) ;
/ / Navigator . pop ( context ) ;
/ / } ,
/ / child: Padding (
/ / padding: const EdgeInsets . all ( 8.0 ) ,
/ / child: Center (
/ / child: Texts (
/ / TranslationBase . of ( context ) . ok ,
/ / fontWeight: FontWeight . w400 ,
/ / ) ) ,
/ / ) ,
/ / ) ) ,
/ / ] ,
/ / )
/ / ] ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ;
/ / }
/ / }