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/ResultByRegion.dart

157 lines
5.0 KiB
Dart

import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
typedef OnRegionSelected = Function(String);
class ResultByRegion extends StatelessWidget {
List<DoctorList> doctorsList = [];
RegionList patientDoctorAppointmentListHospital;
OnRegionSelected onRegionSelected;
ResultByRegion(
{required this.doctorsList,
required this.patientDoctorAppointmentListHospital,
required this.onRegionSelected
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Expanded(
child: patientDoctorAppointmentListHospital
.registeredDoctorMap?.isNotEmpty ==
true
? ListView.separated(
addAutomaticKeepAlives: true,
physics: BouncingScrollPhysics(),
separatorBuilder: (context, index) {
return Material(
color: Color(0xFFf5f5f5),
child: SizedBox(
height: 12,
),
);
},
itemBuilder: (context, index) {
String key = patientDoctorAppointmentListHospital
.registeredDoctorMap?.keys
.toList()[index] ??
'';
return InkWell(
onTap: (){
onRegionSelected(key);
},
child: RegionTitle(
title: key,
hmcCount:
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
hmgCount:
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
),
);
},
itemCount: patientDoctorAppointmentListHospital
.registeredDoctorMap?.length ??
0,
)
: getNoDataWidget(context),
),
],
);
}
}
class RegionTitle extends StatelessWidget {
final String title;
final String hmcCount;
final String hmgCount;
const RegionTitle(
{super.key,
required this.title,
required this.hmcCount,
required this.hmgCount});
@override
Widget build(BuildContext context) {
return Material(
color: CustomColors.white,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 22, color: Colors.black, fontWeight: FontWeight.w700),
),
SizedBox(
height: 8,
),
Row(
children: [
SvgPicture.asset(
'assets/images/svg/HMG.svg',
width: 10,
height: 10,
),
SizedBox(
width: 8,
),
Text(
"${TranslationBase.of(context).HospitalString(num.parse(hmgCount)).replaceAll("@", hmgCount)} ,",
style: TextStyle(
fontSize: 14,
color: Color(0xFFD02127),
fontWeight: FontWeight.w600),
),
SizedBox(
width: 8,
),
SvgPicture.asset(
'assets/images/svg/HMC.svg',
width: 10,
height: 10,
),
SizedBox(
width: 8,
),
Text(
"${TranslationBase.of(context).MedicalCenterString(num.parse(hmcCount)).replaceAll("@", hmcCount)}",
style: TextStyle(
fontSize: 14,
color: Color(0xFF40ACC9),
fontWeight: FontWeight.w600),
),
],
),
],
),
),
Padding(
padding: EdgeInsets.all(8),
child: Center(
child: Icon(
Icons.arrow_forward_ios,
color: CustomColors.black,
size: 16,
),
),
),
],
)
),
);
}
}