You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
5.2 KiB
Dart
122 lines
5.2 KiB
Dart
import 'package:doctor_app_flutter/config/shared_pref_kay.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/model/note/CreateNoteModel.dart';
|
|
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
|
|
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
|
|
import 'package:doctor_app_flutter/core/service/MyReferralPatientService.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/progress_note_request.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/text_fields/app-textfield-custom.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
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;
|
|
TextEditingController progressNoteController = TextEditingController();
|
|
|
|
@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: [
|
|
AppTextFieldCustom(
|
|
hintText: 'Replay your responses here',
|
|
controller: progressNoteController,
|
|
maxLines: 35,
|
|
minLines: 25,
|
|
hasBorder: true,
|
|
validationError:
|
|
progressNoteController.text.isEmpty && isSubmitted
|
|
? TranslationBase.of(context).emptyMessage
|
|
: null,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
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();
|
|
}
|
|
}
|
|
{
|
|
Helpers.showErrorToast("You cant add only spaces");
|
|
setState(() {
|
|
isSubmitted = false;
|
|
});
|
|
}
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|