Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into sultan
commit
872e9cd0bd
@ -0,0 +1,186 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/MyReferralPatientModel.dart';
|
||||
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:speech_to_text/speech_recognition_error.dart';
|
||||
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
||||
|
||||
|
||||
class AddReplayOnReferralPatient extends StatefulWidget {
|
||||
final PatientReferralViewModel patientReferralViewModel;
|
||||
final MyReferralPatientModel myReferralInPatientModel;
|
||||
//TODO Jammal
|
||||
const AddReplayOnReferralPatient(
|
||||
{Key key, this.patientReferralViewModel, this.myReferralInPatientModel})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_AddReplayOnReferralPatientState createState() =>
|
||||
_AddReplayOnReferralPatientState();
|
||||
}
|
||||
|
||||
class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient> {
|
||||
|
||||
bool isSubmitted = false;
|
||||
stt.SpeechToText speech = stt.SpeechToText();
|
||||
var reconizedWord;
|
||||
var event = RobotProvider();
|
||||
TextEditingController progressNoteController = TextEditingController();
|
||||
@override
|
||||
void initState() {
|
||||
requestPermissions();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: false,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 1.0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BottomSheetTitle(title: 'Replay'),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
Center(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.9,
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
AppTextFieldCustom(
|
||||
hintText: 'Replay your responses here',
|
||||
controller: progressNoteController,
|
||||
maxLines: 35,
|
||||
minLines: 25,
|
||||
hasBorder: true,
|
||||
validationError:
|
||||
progressNoteController.text.isEmpty &&
|
||||
isSubmitted
|
||||
? TranslationBase.of(context).emptyMessage
|
||||
: null,
|
||||
),
|
||||
Positioned(
|
||||
top: 0,//MediaQuery.of(context).size.height * 0,
|
||||
right: 15,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
DoctorApp.speechtotext,
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () {
|
||||
onVoiceText();
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title: 'Submit Replay',
|
||||
color: Color(0xff359846),
|
||||
fontWeight: FontWeight.w700,
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
isSubmitted = true;
|
||||
});
|
||||
if (progressNoteController.text.isNotEmpty) {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await widget.patientReferralViewModel.replay(progressNoteController.text.trim(), widget.myReferralInPatientModel);
|
||||
if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) {
|
||||
Helpers.showErrorToast(widget.patientReferralViewModel.error);
|
||||
} else {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
DrAppToastMsg.showSuccesToast("Your Replay Added Successfully");
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}else {
|
||||
Helpers.showErrorToast("You can't add empty replay");
|
||||
setState(() {
|
||||
isSubmitted = false;
|
||||
});
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onVoiceText() async {
|
||||
new SpeechToText(context: context).showAlertDialog(context);
|
||||
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
|
||||
bool available = await speech.initialize(
|
||||
onStatus: statusListener, onError: errorListener);
|
||||
if (available) {
|
||||
speech.listen(
|
||||
onResult: resultListener,
|
||||
// listenMode: ListenMode.confirmation,
|
||||
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
|
||||
);
|
||||
} else {
|
||||
print("The user has denied the use of speech recognition.");
|
||||
}
|
||||
}
|
||||
|
||||
void errorListener(SpeechRecognitionError error) {}
|
||||
|
||||
void statusListener(String status) {
|
||||
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
|
||||
}
|
||||
|
||||
void requestPermissions() async {
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.microphone,
|
||||
].request();
|
||||
}
|
||||
|
||||
void resultListener(result) {
|
||||
reconizedWord = result.recognizedWords;
|
||||
event.setValue({"searchText": reconizedWord});
|
||||
|
||||
if (result.finalResult == true) {
|
||||
setState(() {
|
||||
SpeechToText.closeAlertDialog(context);
|
||||
progressNoteController.text = reconizedWord;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,475 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/MyReferralPatientModel.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
||||
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../routes.dart';
|
||||
import 'AddReplayOnReferralPatient.dart';
|
||||
|
||||
class ReferralPatientDetailScreen extends StatelessWidget {
|
||||
final MyReferralPatientModel referredPatient;
|
||||
final PatientReferralViewModel patientReferralViewModel;
|
||||
ReferralPatientDetailScreen(this.referredPatient, this.patientReferralViewModel);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
isShowAppBar: false,
|
||||
body: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12.0),
|
||||
child: Row(children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
color: Colors.black, //Colors.black,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
(Helpers.capitalize(
|
||||
"${referredPatient.firstName} ${referredPatient.lastName}")),
|
||||
fontSize: SizeConfig.textMultiplier * 2.5,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
),
|
||||
referredPatient.gender == 1
|
||||
? Icon(
|
||||
DoctorApp.male_2,
|
||||
color: Colors.blue,
|
||||
)
|
||||
: Icon(
|
||||
DoctorApp.female_1,
|
||||
color: Colors.pink,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
PatiantInformtion patient =
|
||||
model.getPatientFromReferralO(referredPatient);
|
||||
Navigator.of(context)
|
||||
.pushNamed(PATIENTS_PROFILE, arguments: {
|
||||
"patient": patient,
|
||||
"patientType": "1",
|
||||
"isInpatient": true,
|
||||
"arrivalType": "1",
|
||||
"from": DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
|
||||
"to": DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
Icons.account_circle,
|
||||
size: 25,
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12.0),
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
child: Image.network(
|
||||
referredPatient.doctorImageURL
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppText(
|
||||
"${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: 1.9 * SizeConfig.textMultiplier,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: referredPatient.referralStatus == 1
|
||||
? Color(0xffc4aa54)
|
||||
: referredPatient.referralStatus == 46
|
||||
? Colors.green[700]
|
||||
: Colors.red[700],
|
||||
),
|
||||
AppText(
|
||||
DateUtils.getDayMonthYearDateFormatted(referredPatient.referralDate,),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 2.0 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF28353E),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.fileNumber,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize:
|
||||
1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
AppText(
|
||||
"${referredPatient.patientID}",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:
|
||||
1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
AppText(
|
||||
DateUtils.getTimeHHMMA(referredPatient.referralDate,),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"${TranslationBase.of(context).refClinic}: ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
AppText(
|
||||
referredPatient
|
||||
.referringClinicDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.8 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.frequency +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
referredPatient
|
||||
.frequencyDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.8 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
AppText(
|
||||
referredPatient.nationalityName !=
|
||||
null
|
||||
? referredPatient.nationalityName
|
||||
: "",
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF2E303A),
|
||||
fontSize:
|
||||
1.4 * SizeConfig.textMultiplier,
|
||||
),
|
||||
referredPatient.nationalityFlagURL !=
|
||||
null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.0),
|
||||
child: Image.network(
|
||||
referredPatient
|
||||
.nationalityFlagURL,
|
||||
height: 25,
|
||||
width: 30,
|
||||
errorBuilder: (BuildContext
|
||||
context,
|
||||
Object exception,
|
||||
StackTrace stackTrace) {
|
||||
return Text('No Image');
|
||||
},
|
||||
))
|
||||
: SizedBox()
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).priority +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
referredPatient.priorityDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:
|
||||
1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.maxResponseTime +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
DateUtils.convertDateFromServerFormat(
|
||||
referredPatient.mAXResponseTime,
|
||||
"dd MMM,yyyy"),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:
|
||||
1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 0),
|
||||
child: Image.asset(
|
||||
'assets/images/patient/ic_ref_arrow_left.png',
|
||||
height: 50,
|
||||
width: 30,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 25,
|
||||
right: 0,
|
||||
bottom: 0),
|
||||
padding: EdgeInsets.only(
|
||||
left: 4.0, right: 4.0),
|
||||
child: referredPatient.doctorImageURL !=
|
||||
null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.0),
|
||||
child: Image.network(
|
||||
referredPatient.doctorImageURL,
|
||||
height: 25,
|
||||
width: 30,
|
||||
errorBuilder:
|
||||
(BuildContext context,
|
||||
Object exception,
|
||||
StackTrace stackTrace) {
|
||||
return Text('No Image');
|
||||
},
|
||||
))
|
||||
: Container(
|
||||
child: Image.asset(
|
||||
referredPatient.gender == 1
|
||||
? 'assets/images/male_avatar.png'
|
||||
: 'assets/images/female_avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 10,
|
||||
top: 30,
|
||||
right: 10,
|
||||
bottom: 0),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"Dr ${referredPatient.referringDoctorName}",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 1.5 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Colors.black,
|
||||
),
|
||||
AppText(
|
||||
referredPatient
|
||||
.referringClinicDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.3 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1.0,
|
||||
)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).remarks,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 2.4 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
AppText(
|
||||
referredPatient.referringDoctorRemarks,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).replay,
|
||||
color: Colors.red[700],
|
||||
fontColor: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.8,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
onPressed: () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
SlideUpPageRoute(
|
||||
widget: AddReplayOnReferralPatient(patientReferralViewModel: patientReferralViewModel,myReferralInPatientModel: referredPatient,),),);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,527 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../routes.dart';
|
||||
|
||||
class ReferredPatientDetailScreen extends StatelessWidget {
|
||||
final MyReferredPatientModel referredPatient;
|
||||
|
||||
ReferredPatientDetailScreen(this.referredPatient);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
isShowAppBar: false,
|
||||
body: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12.0),
|
||||
child: Row(children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
color: Colors.black, //Colors.black,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
(Helpers.capitalize(
|
||||
"${referredPatient.firstName} ${referredPatient.lastName}")),
|
||||
fontSize: SizeConfig.textMultiplier * 2.5,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
),
|
||||
referredPatient.gender == 1
|
||||
? Icon(
|
||||
DoctorApp.male_2,
|
||||
color: Colors.blue,
|
||||
)
|
||||
: Icon(
|
||||
DoctorApp.female_1,
|
||||
color: Colors.pink,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
PatiantInformtion patient =
|
||||
model.getPatientFromReferral(referredPatient);
|
||||
Navigator.of(context)
|
||||
.pushNamed(PATIENTS_PROFILE, arguments: {
|
||||
"patient": patient,
|
||||
"patientType": "1",
|
||||
"isInpatient": true,
|
||||
"arrivalType": "1",
|
||||
"from": DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
|
||||
"to": DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
Icons.account_circle,
|
||||
size: 25,
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12.0),
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
child: Image.asset(
|
||||
referredPatient.gender == 1
|
||||
? 'assets/images/male_avatar.png'
|
||||
: 'assets/images/female_avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppText(
|
||||
"${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: 1.9 * SizeConfig.textMultiplier,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: referredPatient.referralStatus == 1
|
||||
? Color(0xffc4aa54)
|
||||
: referredPatient.referralStatus == 46
|
||||
? Colors.green[700]
|
||||
: Colors.red[700],
|
||||
),
|
||||
AppText(
|
||||
DateUtils.convertDateFromServerFormat(
|
||||
referredPatient.referralDate,
|
||||
"dd MMM,yyyy"),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 2.0 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF28353E),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.fileNumber,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
AppText(
|
||||
"${referredPatient.patientID}",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:14,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
AppText(
|
||||
DateUtils.convertDateFromServerFormat(
|
||||
referredPatient.referralDate,
|
||||
"hh:mm a"),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"${TranslationBase.of(context).refClinic}: ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
referredPatient
|
||||
.referralClinicDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 13,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.frequency +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
referredPatient
|
||||
.frequencyDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 14,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
AppText(
|
||||
referredPatient.nationalityName !=
|
||||
null
|
||||
? referredPatient.nationalityName
|
||||
: "",
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF2E303A),
|
||||
fontSize:
|
||||
1.4 * SizeConfig.textMultiplier,
|
||||
),
|
||||
referredPatient.nationalityFlagURL !=
|
||||
null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.0),
|
||||
child: Image.network(
|
||||
referredPatient
|
||||
.nationalityFlagURL,
|
||||
height: 25,
|
||||
width: 30,
|
||||
errorBuilder: (BuildContext
|
||||
context,
|
||||
Object exception,
|
||||
StackTrace stackTrace) {
|
||||
return Text('No Image');
|
||||
},
|
||||
))
|
||||
: SizedBox()
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).priority +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
AppText(
|
||||
referredPatient.priorityDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:14,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.maxResponseTime +
|
||||
": ",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF575757),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
DateUtils.convertDateFromServerFormat(
|
||||
referredPatient.mAXResponseTime,
|
||||
"dd MMM,yyyy"),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize:
|
||||
1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 0),
|
||||
child: Image.asset(
|
||||
'assets/images/patient/ic_ref_arrow_left.png',
|
||||
height: 50,
|
||||
width: 30,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 25,
|
||||
right: 0,
|
||||
bottom: 0),
|
||||
padding: EdgeInsets.only(
|
||||
left: 4.0, right: 4.0),
|
||||
child: referredPatient.doctorImageURL !=
|
||||
null
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.0),
|
||||
child: Image.network(
|
||||
referredPatient.doctorImageURL,
|
||||
height: 25,
|
||||
width: 30,
|
||||
errorBuilder:
|
||||
(BuildContext context,
|
||||
Object exception,
|
||||
StackTrace stackTrace) {
|
||||
return Text('No Image');
|
||||
},
|
||||
))
|
||||
: Container(
|
||||
child: Image.asset(
|
||||
referredPatient.gender == 1
|
||||
? 'assets/images/male_avatar.png'
|
||||
: 'assets/images/female_avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 10,
|
||||
top: 30,
|
||||
right: 10,
|
||||
bottom: 0),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"Dr ${referredPatient.referralDoctorName}",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 1.5 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Colors.black,
|
||||
),
|
||||
AppText(
|
||||
referredPatient.referralClinicDescription,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.3 *
|
||||
SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1.0,
|
||||
)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).remarks,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 2.4 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
AppText(
|
||||
referredPatient.referringDoctorRemarks,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 0, top: 0, right: 4, bottom: 0),
|
||||
padding: EdgeInsets.only(left: 4.0, right: 4.0),
|
||||
child: referredPatient.doctorImageURL != null
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
child: Image.network(
|
||||
referredPatient.doctorImageURL,
|
||||
height: 25,
|
||||
width: 30,
|
||||
errorBuilder: (BuildContext context,
|
||||
Object exception,
|
||||
StackTrace stackTrace) {
|
||||
return Text('No Image');
|
||||
},
|
||||
))
|
||||
: Container(
|
||||
child: Image.asset(
|
||||
referredPatient.gender == 1
|
||||
? 'assets/images/male_avatar.png'
|
||||
: 'assets/images/female_avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).reply,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.8 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
AppText(
|
||||
referredPatient.referredDoctorRemarks.isNotEmpty? referredPatient.referredDoctorRemarks:" Not Replied yet",
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 1.6 * SizeConfig.textMultiplier,
|
||||
color: Color(0XFF2E303A),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if(referredPatient.referralStatus ==1)
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).acknowledged,
|
||||
color: Colors.red[700],
|
||||
fontColor: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 1.8,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
onPressed: () async {
|
||||
await model.verifyReferralDoctorRemarks(referredPatient);
|
||||
if (model.state == ViewState.ErrorLocal) {
|
||||
DrAppToastMsg.showErrorToast(model.error);
|
||||
} else {
|
||||
DrAppToastMsg.showSuccesToast("Referral is acknowledged");
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue