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.
249 lines
10 KiB
Dart
249 lines
10 KiB
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/models/Appointments/OBGyneProcedureListResponse.dart';
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
typedef OnHospitalSelected = Function(String, int);
|
|
|
|
class ResultByHospital extends StatelessWidget {
|
|
List<DoctorList> doctorsList = [];
|
|
List<PatientDoctorAppointmentList>? paitientDoctorAppointmentList;
|
|
bool isHMCSelected;
|
|
|
|
bool isLiveCareAppointment;
|
|
bool isObGyneAppointment;
|
|
bool isDoctorNameSearch;
|
|
OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
|
bool isDoctorSearchResult;
|
|
OnHospitalSelected onHospitalSelected;
|
|
|
|
ResultByHospital(
|
|
{required this.doctorsList,
|
|
required this.paitientDoctorAppointmentList,
|
|
required this.isHMCSelected,
|
|
this.isObGyneAppointment = false,
|
|
this.isDoctorNameSearch = false,
|
|
required this.isLiveCareAppointment,
|
|
required this.isDoctorSearchResult,
|
|
this.obGyneProcedureListResponse,
|
|
required this.onHospitalSelected});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Expanded(
|
|
child: HospitalBodyWidget(
|
|
patientDoctorAppointmentListHospital: paitientDoctorAppointmentList,
|
|
isLiveCareAppointment: isLiveCareAppointment,
|
|
isObGyneAppointment: isObGyneAppointment,
|
|
isDoctorNameSearch: isDoctorNameSearch,
|
|
isDoctorSearchResult: isDoctorSearchResult,
|
|
onHospitalSelected: onHospitalSelected,
|
|
isHMC: isHMCSelected),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class HospitalBodyWidget extends StatelessWidget {
|
|
final List<PatientDoctorAppointmentList>?
|
|
patientDoctorAppointmentListHospital;
|
|
final bool isLiveCareAppointment;
|
|
final bool isObGyneAppointment;
|
|
final bool isDoctorNameSearch;
|
|
final bool isDoctorSearchResult;
|
|
final OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
|
final OnHospitalSelected onHospitalSelected;
|
|
final bool isHMC;
|
|
|
|
const HospitalBodyWidget(
|
|
{super.key,
|
|
this.patientDoctorAppointmentListHospital,
|
|
required this.isLiveCareAppointment,
|
|
required this.isObGyneAppointment,
|
|
required this.isDoctorNameSearch,
|
|
required this.isDoctorSearchResult,
|
|
this.obGyneProcedureListResponse,
|
|
required this.onHospitalSelected,
|
|
required this.isHMC});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.separated(
|
|
addAutomaticKeepAlives: true,
|
|
shrinkWrap: true,
|
|
physics: BouncingScrollPhysics(),
|
|
itemCount: patientDoctorAppointmentListHospital?.length ?? 0,
|
|
separatorBuilder: (context, index) {
|
|
return Container(
|
|
height: 12,
|
|
margin: EdgeInsets.only(left: 21, right: 21),
|
|
);
|
|
},
|
|
itemBuilder: (context, index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
onHospitalSelected(
|
|
patientDoctorAppointmentListHospital![index].filterName ?? '',
|
|
index);
|
|
},
|
|
child: Material(
|
|
color: CustomColors.white,
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(6.0),
|
|
child: SvgPicture.asset(
|
|
isHMC
|
|
? 'assets/images/svg/HMC.svg'
|
|
: 'assets/images/svg/HMG.svg',
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Directionality(
|
|
textDirection: (context
|
|
.read<ProjectViewModel>()
|
|
.isArabic ==
|
|
true)
|
|
? TextDirection.rtl
|
|
: TextDirection.ltr,
|
|
child: Text(
|
|
patientDoctorAppointmentListHospital![index]
|
|
.filterName ??
|
|
'',
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
color: isHMC
|
|
? Color(0xFF40ACC9)
|
|
: Color(0xFFD02127),
|
|
fontWeight: FontWeight.w700),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Visibility(
|
|
visible:
|
|
(patientDoctorAppointmentListHospital?[index]
|
|
.distanceInKMs !=
|
|
"0"),
|
|
child: Row(
|
|
children: [
|
|
SvgPicture.asset(
|
|
'assets/images/svg/location.svg',
|
|
),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
Text(
|
|
// "${TranslationBase.of(context).nearest}: ${patientDoctorAppointmentListHospital?[index].distanceInKMs} ${TranslationBase.of(context).kilometerUnit}",
|
|
"${patientDoctorAppointmentListHospital?[index].distanceInKMs} ${TranslationBase.of(context).kilometerUnit}",
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.all(8),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.arrow_forward_ios,
|
|
color: CustomColors.black,
|
|
size: 16,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)),
|
|
),
|
|
);
|
|
// return AppExpandableNotifier(
|
|
// applyBackgroundColor: false,
|
|
// widgetColor: CustomColors.appBackgroudGrey2Color,
|
|
// title: (patientDoctorAppointmentListHospital?[index].distanceInKMs !=
|
|
// "0")
|
|
// ? patientDoctorAppointmentListHospital![index].filterName! +
|
|
// " - " +
|
|
// patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
|
// " " +
|
|
// TranslationBase.of(context).km
|
|
// : patientDoctorAppointmentListHospital![index].filterName,
|
|
// projectTitleTop:
|
|
// patientDoctorAppointmentListHospital![index].projectTopName,
|
|
// projectTitleBottom: (patientDoctorAppointmentListHospital![index]
|
|
// .distanceInKMs !=
|
|
// "0")
|
|
// ? patientDoctorAppointmentListHospital![index]
|
|
// .projectBottomName
|
|
// .toString() +
|
|
// " - " +
|
|
// patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
|
// " " +
|
|
// TranslationBase.of(context).km
|
|
// : patientDoctorAppointmentListHospital![index]
|
|
// .projectBottomName
|
|
// .toString(),
|
|
// isTitleSingleLine: false,
|
|
// isDoctorSearchResult: isDoctorSearchResult,
|
|
// isDisabled: true,
|
|
// isExpand:
|
|
// patientDoctorAppointmentListHospital?.length == 1 ? true : false,
|
|
// // bodyWidget: ListView.separated(
|
|
// // shrinkWrap: true,
|
|
// // physics: NeverScrollableScrollPhysics(),
|
|
// // padding:
|
|
// // EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21),
|
|
// // itemBuilder: (context, _index) {
|
|
// // // print("the index of patientDoctorAppointmentList is ${_index}");
|
|
// // // print("the index of parent is ${index}");
|
|
// // final doctor = patientDoctorAppointmentListHospital![index]
|
|
// // .patientDoctorAppointmentList![_index];
|
|
// // // print('the doctor is ${doctor.toJson()}');
|
|
// // return DoctorView(
|
|
// // doctor: doctor,
|
|
// // isLiveCareAppointment: isLiveCareAppointment,
|
|
// // isObGyneAppointment: isObGyneAppointment,
|
|
// // isDoctorNameSearch: isDoctorNameSearch,
|
|
// // obGyneProcedureListResponse: obGyneProcedureListResponse,
|
|
// // isShowDate: false,
|
|
// // onTap: () {
|
|
// // context
|
|
// // .read<ProjectViewModel>()
|
|
// // .analytics
|
|
// // .appointment
|
|
// // .book_appointment_select_doctor(
|
|
// // appointment_type: 'regular', doctor: doctor);
|
|
// // });
|
|
// // },
|
|
// // separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
// // itemCount: patientDoctorAppointmentListHospital?[index].patientDoctorAppointmentList?.length ?? 0),
|
|
// );
|
|
},
|
|
);
|
|
}
|
|
}
|