@ -7,12 +7,14 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import ' package:hmg_patient_app_new/extensions/string_extensions.dart ' ;
import ' package:hmg_patient_app_new/extensions/string_extensions.dart ' ;
import ' package:hmg_patient_app_new/extensions/widget_extensions.dart ' ;
import ' package:hmg_patient_app_new/extensions/widget_extensions.dart ' ;
import ' package:hmg_patient_app_new/core/utils/utils.dart ' show Utils ;
import ' package:hmg_patient_app_new/core/utils/utils.dart ' show Utils ;
import ' package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart ' ;
import ' package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart ' ;
import ' package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart ' ;
import ' package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart ' ;
import ' package:hmg_patient_app_new/generated/locale_keys.g.dart ' ;
import ' package:hmg_patient_app_new/generated/locale_keys.g.dart ' ;
import ' package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart ' ;
import ' package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart ' ;
import ' package:hmg_patient_app_new/theme/colors.dart ' show AppColors ;
import ' package:hmg_patient_app_new/theme/colors.dart ' show AppColors ;
import ' package:hmg_patient_app_new/widgets/input_widget.dart ' ;
import ' package:hmg_patient_app_new/widgets/input_widget.dart ' ;
import ' package:provider/provider.dart ' ;
import ' ../../../emergency_services/call_ambulance/widgets/type_selection_widget.dart ' show TypeSelectionWidget ;
import ' ../../../emergency_services/call_ambulance/widgets/type_selection_widget.dart ' show TypeSelectionWidget ;
@ -131,7 +133,19 @@ class HospitalBottomSheetBody extends StatelessWidget {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Consumer < BookAppointmentsViewModel > ( builder: ( context , myAppointmentsVM , child ) {
if ( myAppointmentsVM . isRegionListLoading ) {
return Container (
height: MediaQuery . of ( context ) . size . height * 0.3 ,
decoration: BoxDecoration (
color: AppColors . whiteColor ,
borderRadius: BorderRadius . vertical ( top: Radius . circular ( 16 ) ) ,
) ,
child: Center (
child: Utils . getLoadingWidget ( ) ,
) ,
) ;
} else {
return Column (
return Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
@ -140,13 +154,12 @@ class HospitalBottomSheetBody extends StatelessWidget {
hintText: LocaleKeys . searchHospital . tr ( context: context ) ,
hintText: LocaleKeys . searchHospital . tr ( context: context ) ,
controller: searchText ,
controller: searchText ,
onChange: ( value ) {
onChange: ( value ) {
debouncer . run ( ( ) {
debouncer . run ( ( ) {
onHospitalSearch ( value ? ? " " ) ;
onHospitalSearch ( value ? ? " " ) ;
} ) ;
} ) ;
} ,
} ,
isEnable: true ,
isEnable: true ,
prefix: null ,
prefix: null ,
autoFocus: false ,
autoFocus: false ,
isBorderAllowed: false ,
isBorderAllowed: false ,
keyboardType: TextInputType . text ,
keyboardType: TextInputType . text ,
@ -189,10 +202,10 @@ class HospitalBottomSheetBody extends StatelessWidget {
) ,
) ,
if ( onSortByLocationToggle ! = null ) SizedBox ( height: 8. h ) ,
if ( onSortByLocationToggle ! = null ) SizedBox ( height: 8. h ) ,
TypeSelectionWidget (
TypeSelectionWidget (
selectedFacility: selectedFacility ,
selectedFacility: selectedFacility ,
hmcCount: hmcCount . toString ( ) ,
hmcCount: hmcCount . toString ( ) ,
hmgCount: hmgCount . toString ( ) ,
hmgCount: hmgCount . toString ( ) ,
onitemClicked: ( selectedValue ) {
onitemClicked: ( selectedValue ) {
onFacilityClicked ( selectedValue ) ;
onFacilityClicked ( selectedValue ) ;
} ,
} ,
) ,
) ,
@ -200,15 +213,15 @@ class HospitalBottomSheetBody extends StatelessWidget {
SizedBox (
SizedBox (
height: MediaQuery . sizeOf ( context ) . height * . 4 ,
height: MediaQuery . sizeOf ( context ) . height * . 4 ,
child: ListView . separated (
child: ListView . separated (
itemBuilder: ( _ , index )
itemBuilder: ( _ , index ) {
{
var hospital = displayList ? [ index ] ;
var hospital = displayList ? [ index ] ;
return HospitalListItem (
return HospitalListItem (
hospitalData: hospital ,
hospitalData: hospital ,
isLocationEnabled: sortByLocation ,
isLocationEnabled: sortByLocation ,
) . onPress ( ( ) {
) . onPress ( ( ) {
onHospitalClicked ( hospital ! ) ;
onHospitalClicked ( hospital ! ) ;
} ) ; } ,
} ) ;
} ,
separatorBuilder: ( _ , __ ) = > SizedBox (
separatorBuilder: ( _ , __ ) = > SizedBox (
height: 16. h ,
height: 16. h ,
) ,
) ,
@ -217,5 +230,7 @@ class HospitalBottomSheetBody extends StatelessWidget {
] ,
] ,
) ;
) ;
}
}
} ) ;
}
}
}