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.
HMG_Patient_App/lib/pages/rateAppointment/rate_appointment_doctor.dart

269 lines
11 KiB
Dart

9 months ago
import 'package:hmg_patient_app/core/viewModels/appointment_rate_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/models/Appointments/DoctorListResponse.dart';
import 'package:hmg_patient_app/pages/BookAppointment/widgets/DoctorView.dart';
import 'package:hmg_patient_app/pages/base/base_view.dart';
import 'package:hmg_patient_app/pages/insurance/insurance_update_screen.dart';
import 'package:hmg_patient_app/pages/landing/landing_page.dart';
import 'package:hmg_patient_app/pages/rateAppointment/rate_appointment_clinic.dart';
import 'package:hmg_patient_app/theme/colors.dart';
import 'package:hmg_patient_app/uitl/app_toast.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
import 'package:hmg_patient_app/widgets/dialogs/confirm_dialog.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class RateAppointmentDoctor extends StatefulWidget {
bool isFromRegistration;
RateAppointmentDoctor({Key? key, this.isFromRegistration = false}) : super(key: key);
@override
_RateAppointmentDoctorState createState() => _RateAppointmentDoctorState();
}
class _RateAppointmentDoctorState extends State<RateAppointmentDoctor> {
final formKey = GlobalKey<FormState>();
String note = "";
int rating = 0;
Merge branch 'development_v3.3' of http://34.17.52.79/Haroon6138/diplomatic-quarter into dev_v3.13.6 # Conflicts: # lib/config/config.dart # lib/core/model/labs/patient_lab_orders.dart # lib/core/model/labs/request_patient_lab_special_result.dart # lib/core/model/labs/request_send_lab_report_email.dart # lib/core/model/radiology/final_radiology.dart # lib/core/model/radiology/request_send_rad_report_email.dart # lib/core/model/rate/appoitment_rated.dart # lib/core/service/client/base_app_client.dart # lib/core/service/medical/labs_service.dart # lib/core/service/medical/radiology_service.dart # lib/core/viewModels/medical/labs_view_model.dart # lib/core/viewModels/medical/radiology_view_model.dart # lib/models/Authentication/check_activation_code_request.dart # lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart # lib/pages/BookAppointment/BookSuccess.dart # lib/pages/BookAppointment/QRCode.dart # lib/pages/DrawerPages/family/my-family.dart # lib/pages/DrawerPages/notifications/notification_details_page.dart # lib/pages/MyAppointments/AppointmentDetails.dart # lib/pages/MyAppointments/MyAppointments.dart # lib/pages/MyAppointments/widgets/AppointmentActions.dart # lib/pages/ToDoList/ToDo.dart # lib/pages/landing/landing_page.dart # lib/pages/livecare/widgets/clinic_list.dart # lib/pages/login/confirm-login.dart # lib/pages/login/login.dart # lib/pages/medical/labs/laboratory_result_page.dart # lib/pages/medical/radiology/radiology_details_page.dart # lib/services/authentication/auth_provider.dart # lib/splashPage.dart # lib/uitl/push-notification-handler.dart # lib/widgets/drawer/app_drawer_widget.dart
2 years ago
ProjectViewModel? projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return BaseView<AppointmentRateViewModel>(
builder: (_, model, w) => SafeArea(
top: false,
child: AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: model,
appBarTitle: TranslationBase.of(context).rateDoctor,
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase.of(context).lastVisit,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 23 / 16),
5 years ago
),
SizedBox(
height: 25,
),
Container(
child: DoctorView(
doctor: getDoctorObject(model),
isLiveCareAppointment: false,
isShowFlag: false,
),
5 years ago
),
SizedBox(
height: 12,
),
Container(
width: double.infinity,
child: Container(
decoration: cardRadius(10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).tapTitle,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 23 / 16),
),
SizedBox(
height: 12,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
...List.generate(
5,
(index) => AnimatedSwitcher(
duration: Duration(milliseconds: 1000),
switchInCurve: Curves.elasticOut,
switchOutCurve: Curves.elasticIn,
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
child: child, scale: animation);
},
child: Container(
key: ValueKey<int>(rating),
child: IconButton(
iconSize: 45.0,
onPressed: () {
setState(() {
rating = index + 1;
});
},
color: rating >= (index + 1)
? Color.fromRGBO(255, 186, 0, 1.0)
: Colors.grey[400],
icon: Icon(rating >= (index + 1)
? Icons.star
: Icons.star)),
),
),
)
],
),
],
),
),
),
),
SizedBox(
height: 12,
),
Container(
decoration: cardRadius(10),
child: Padding(
padding: EdgeInsets.all(8.0),
child: TextField(
maxLines: 5,
decoration: InputDecoration.collapsed(
hintText: TranslationBase.of(context).notes,
hintStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.64,
height: 23 / 16)),
onChanged: (value) {
setState(() {
note = value;
});
},
))),
],
),
5 years ago
),
),
bottomSheet: Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: DefaultButton(
TranslationBase.of(context).later,
() {
if(widget.isFromRegistration) {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).validInsurance,
okText: TranslationBase.of(context).yes,
cancelText: TranslationBase.of(context).no,
okFunction: () {
ConfirmDialog.closeAlertDialog(context);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
cancelFunction: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
});
dialog.showAlertDialog(context);
} else {
Navigator.pushReplacement(
context,
FadePage(
page: LandingPage(),
),
);
// if(projectViewModel.isLoginChild) {
// Navigator.pushReplacement(
// context,
// FadePage(
// page: LandingPage(),
// ),
// );
// } else {
// Navigator.pop(
// context,
// // FadePage(
// // page: LandingPage(),
// // ),
// );
// }
}
},
color: CustomColors.accentColor,
textColor: Colors.white,
),
),
SizedBox(width: 10),
Expanded(
child: DefaultButton(
TranslationBase.of(context).next,
rating <= 0
? null
: () {
Navigator.push(
context,
FadePage(
page: RateAppointmentClinic(
appointmentDetails: model.appointmentDetails,
doctorNote: note,
doctorRate: rating,
),
),
);
},
// iconData: Icons.notifications_active,
color: Color(0xff359846),
disabledColor: Colors.grey,
),
),
],
),
),
),
),
);
}
5 years ago
DoctorList getDoctorObject(AppointmentRateViewModel model) {
DoctorList doctor = new DoctorList();
doctor.name = model.appointmentDetails.doctorName;
doctor.doctorImageURL = model.appointmentDetails.doctorImageURL;
doctor.clinicName = model.appointmentDetails.clinicName;
doctor.projectName = model.appointmentDetails.projectName;
doctor.date = model.appointmentDetails.appointmentDate;
5 years ago
doctor.actualDoctorRate = 5;
return doctor;
}
}