|
|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart'
|
|
|
|
|
show tr, StringTranslateExtension;
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension;
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/enums.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/debouncer.dart';
|
|
|
|
|
@ -14,9 +13,9 @@ import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulan
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
|
|
|
|
|
|
|
|
|
class HospitalBottomSheetBody extends StatelessWidget {
|
|
|
|
|
final TextEditingController searchText;
|
|
|
|
|
|
|
|
|
|
final TextEditingController searchText ;
|
|
|
|
|
final Debouncer debouncer = Debouncer(milliseconds: 500);
|
|
|
|
|
final Debouncer debouncer = Debouncer(milliseconds: 500);
|
|
|
|
|
|
|
|
|
|
final int hmcCount;
|
|
|
|
|
final int hmgCount;
|
|
|
|
|
@ -26,11 +25,19 @@ class HospitalBottomSheetBody extends StatelessWidget {
|
|
|
|
|
final Function(HospitalsModel) onHospitalClicked;
|
|
|
|
|
final Function(String) onHospitalSearch;
|
|
|
|
|
|
|
|
|
|
HospitalBottomSheetBody({super.key, required this.hmcCount, required this.hmgCount, this.displayList, required this.selectedFacility, required this.onFacilityClicked, required this.onHospitalClicked, required this.onHospitalSearch, required this.searchText});
|
|
|
|
|
HospitalBottomSheetBody(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.hmcCount,
|
|
|
|
|
required this.hmgCount,
|
|
|
|
|
this.displayList,
|
|
|
|
|
required this.selectedFacility,
|
|
|
|
|
required this.onFacilityClicked,
|
|
|
|
|
required this.onHospitalClicked,
|
|
|
|
|
required this.onHospitalSearch,
|
|
|
|
|
required this.searchText});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -39,13 +46,12 @@ class HospitalBottomSheetBody extends StatelessWidget {
|
|
|
|
|
hintText: LocaleKeys.searchHospital.tr(),
|
|
|
|
|
controller: searchText,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
debouncer.run((){
|
|
|
|
|
onHospitalSearch(value??"");
|
|
|
|
|
debouncer.run(() {
|
|
|
|
|
onHospitalSearch(value ?? "");
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
isEnable: true,
|
|
|
|
|
prefix: null,
|
|
|
|
|
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
@ -58,26 +64,26 @@ class HospitalBottomSheetBody extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
TypeSelectionWidget(
|
|
|
|
|
selectedFacility:selectedFacility ,
|
|
|
|
|
selectedFacility: selectedFacility,
|
|
|
|
|
hmcCount: hmcCount.toString(),
|
|
|
|
|
hmgCount: hmgCount.toString(),
|
|
|
|
|
onitemClicked: (selectedValue){
|
|
|
|
|
onitemClicked: (selectedValue) {
|
|
|
|
|
onFacilityClicked(selectedValue);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 21.h),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.sizeOf(context).height * .4,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (_, index)
|
|
|
|
|
{
|
|
|
|
|
height: MediaQuery.sizeOf(context).height * .4,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (_, index) {
|
|
|
|
|
var hospital = displayList?[index];
|
|
|
|
|
return HospitalListItem(
|
|
|
|
|
hospitalData: Utils.convertToPatientDoctorAppointmentList(hospital),
|
|
|
|
|
isLocationEnabled: true,
|
|
|
|
|
).onPress(() {
|
|
|
|
|
onHospitalClicked(hospital!);
|
|
|
|
|
});},
|
|
|
|
|
).onPress(() {
|
|
|
|
|
onHospitalClicked(hospital!);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (_, __) => SizedBox(
|
|
|
|
|
height: 16.h,
|
|
|
|
|
),
|
|
|
|
|
|