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.
174 lines
5.9 KiB
Dart
174 lines
5.9 KiB
Dart
import 'package:hmg_patient_app/models/Appointments/DoctorListResponse.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';
|
|
|
|
typedef OnFacilitySelected = Function(bool);
|
|
|
|
class ResultByFacility extends StatelessWidget {
|
|
List<DoctorList> doctorsList = [];
|
|
String selectedRegion = '';
|
|
RegionList patientDoctorAppointmentListHospital;
|
|
OnFacilitySelected onFacilitySelected;
|
|
|
|
ResultByFacility(
|
|
{required this.doctorsList,
|
|
required this.patientDoctorAppointmentListHospital,
|
|
required this.onFacilitySelected,
|
|
required this.selectedRegion});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Visibility(
|
|
visible: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmgSize !=
|
|
0,
|
|
child: InkWell(
|
|
onTap: () {
|
|
if (patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmgSize ==
|
|
0) return;
|
|
onFacilitySelected(false);
|
|
},
|
|
child: HospitalTitle(
|
|
iconUrl: 'assets/images/svg/HMG.svg',
|
|
title: TranslationBase.of(context).hmgHospital,
|
|
isHMC: false,
|
|
itemCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[selectedRegion]?.hmgSize ?? 0}",
|
|
nearest: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmgDistance),
|
|
),
|
|
),
|
|
SizedBox(height: 16,),
|
|
Visibility(
|
|
visible: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmcSize !=
|
|
0,
|
|
child: InkWell(
|
|
onTap: () {
|
|
if (patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmcSize ==
|
|
0) return;
|
|
onFacilitySelected(true);
|
|
},
|
|
child: HospitalTitle(
|
|
iconUrl: 'assets/images/svg/HMC.svg',
|
|
title: TranslationBase.of(context).hmcHospital,
|
|
isHMC: true,
|
|
itemCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[selectedRegion]?.hmcSize ?? 0}",
|
|
nearest: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]?.hmcDistance),
|
|
),
|
|
)
|
|
]);
|
|
}
|
|
}
|
|
|
|
class HospitalTitle extends StatelessWidget {
|
|
final String title;
|
|
final String iconUrl;
|
|
final bool isHMC;
|
|
final num? nearest;
|
|
final String itemCount;
|
|
|
|
const HospitalTitle(
|
|
{super.key,
|
|
required this.title,
|
|
required this.iconUrl,
|
|
required this.isHMC,
|
|
required this.itemCount,this.nearest});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Colors.white,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SvgPicture.asset(iconUrl),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
color:
|
|
isHMC ? Color(0xFF40ACC9) : Color(0xFFD02127),
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
isHMC
|
|
? "${TranslationBase.of(context).MedicalCenterString(num.parse(itemCount)).replaceAll("@", itemCount)}"
|
|
: "${TranslationBase.of(context).HospitalString(num.parse(itemCount)).replaceAll("@", itemCount)}",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
Visibility(
|
|
visible: nearest != double.infinity &&
|
|
nearest != "0" &&
|
|
nearest != 0,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
SvgPicture.asset(
|
|
'assets/images/svg/location.svg',
|
|
),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
Text(
|
|
"${TranslationBase.of(context).nearest}: $nearest ${TranslationBase.of(context).kilometerUnit}",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.all(8),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.arrow_forward_ios,
|
|
color: CustomColors.black,
|
|
size: 16,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|