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.
diplomatic-quarter/lib/pages/BookAppointment/search_result/ResultByFacility.dart

125 lines
4.1 KiB
Dart

import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.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: [
HospitalTitle(
iconUrl: 'assets/images/svg/HMG.svg',
title: TranslationBase.of(context).hmgHospital,
isHMC: false,
itemCount:
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
nearest: patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgDistance
),
SizedBox(height: 16,),
HospitalTitle(
iconUrl: 'assets/images/svg/HMC.svg',
title: TranslationBase.of(context).hmcHospital,
isHMC: true,
itemCount:
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
nearest: patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.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 Padding(
padding: const EdgeInsets.all(8.0),
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).hmcHospitalCount.replaceAll("@", itemCount)}"
: "${TranslationBase.of(context).hmgHospitalCount.replaceAll("@", itemCount)}",
style: TextStyle(
fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600),
),
Visibility(
visible: nearest != double.infinity,
child: Row(
children: [
SizedBox(width: 8,),
Icon(Icons.location_on, color: Colors.black,),
SizedBox(width: 8,),
Text(
"${TranslationBase.of(context).nearest}: $nearest",
style: TextStyle(
fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600),
),
],
),
),
],
),
],
),
);
}
}