@ -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,91 +133,104 @@ class HospitalBottomSheetBody extends StatelessWidget {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Consumer < BookAppointmentsViewModel > ( builder: ( context , myAppointmentsVM , child ) {
return Column (
if ( myAppointmentsVM . isRegionListLoading ) {
crossAxisAlignment: CrossAxisAlignment . start ,
return Container (
children: [
height: MediaQuery . of ( context ) . size . height * 0.3 ,
TextInputWidget (
decoration: BoxDecoration (
labelText: LocaleKeys . search . tr ( context: context ) ,
color: AppColors . whiteColor ,
hintText: LocaleKeys . searchHospital . tr ( context: context ) ,
borderRadius: BorderRadius . vertical ( top: Radius . circular ( 16 ) ) ,
controller: searchText ,
) ,
onChange: ( value ) {
child: Center (
debouncer . run ( ( ) {
child: Utils . getLoadingWidget ( ) ,
onHospitalSearch ( value ? ? " " ) ;
} ) ;
} ,
isEnable: true ,
prefix: null ,
autoFocus: false ,
isBorderAllowed: false ,
keyboardType: TextInputType . text ,
isAllowLeadingIcon: true ,
selectionType: SelectionTypeEnum . search ,
padding: EdgeInsets . symmetric (
vertical: ResponsiveExtension ( 10 ) . h ,
horizontal: ResponsiveExtension ( 15 ) . h ,
) ,
) ,
) ,
) ;
SizedBox ( height: 16. h ) ,
} else {
if ( onSortByLocationToggle ! = null )
return Column (
Padding (
crossAxisAlignment: CrossAxisAlignment . start ,
padding: EdgeInsets . symmetric ( horizontal: 4. w ) ,
children: [
child: Row (
TextInputWidget (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
labelText: LocaleKeys . search . tr ( context: context ) ,
children: [
hintText: LocaleKeys . searchHospital . tr ( context: context ) ,
Row (
controller: searchText ,
onChange: ( value ) {
debouncer . run ( ( ) {
onHospitalSearch ( value ? ? " " ) ;
} ) ;
} ,
isEnable: true ,
prefix: null ,
autoFocus: false ,
isBorderAllowed: false ,
keyboardType: TextInputType . text ,
isAllowLeadingIcon: true ,
selectionType: SelectionTypeEnum . search ,
padding: EdgeInsets . symmetric (
vertical: ResponsiveExtension ( 10 ) . h ,
horizontal: ResponsiveExtension ( 15 ) . h ,
) ,
) ,
SizedBox ( height: 16. h ) ,
if ( onSortByLocationToggle ! = null )
Padding (
padding: EdgeInsets . symmetric ( horizontal: 4. w ) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [
Utils . buildSvgWithAssets ( icon: AppAssets . location , iconColor: AppColors . greyTextColor , width: 18. h , height: 18. h ) ,
Row (
SizedBox ( width: 8. w ) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
LocaleKeys . sortByLocation . tr ( context: context ) . toText14 ( isBold: true ) ,
Utils . buildSvgWithAssets ( icon: AppAssets . location , iconColor: AppColors . greyTextColor , width: 18. h , height: 18. h ) ,
/ / SizedBox ( height: 4. h ) ,
SizedBox ( width: 8. w ) ,
LocaleKeys . sortByNearestLocation . tr ( context: context ) . toText11 ( color: AppColors . textColorLight , weight: FontWeight . w500 ) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
LocaleKeys . sortByLocation . tr ( context: context ) . toText14 ( isBold: true ) ,
/ / SizedBox ( height: 4. h ) ,
LocaleKeys . sortByNearestLocation . tr ( context: context ) . toText11 ( color: AppColors . textColorLight , weight: FontWeight . w500 ) ,
] ,
) ,
] ,
] ,
) ,
) ,
Switch (
value: sortByLocation ,
onChanged: onSortByLocationToggle ,
activeThumbColor: AppColors . successColor ,
activeTrackColor: AppColors . successColor . withValues ( alpha: 0.15 ) ,
) ,
] ,
] ,
) ,
) ,
Switch (
value: sortByLocation ,
onChanged: onSortByLocationToggle ,
activeThumbColor: AppColors . successColor ,
activeTrackColor: AppColors . successColor . withValues ( alpha: 0.15 ) ,
) ,
] ,
) ,
) ,
if ( onSortByLocationToggle ! = null ) SizedBox ( height: 8. h ) ,
TypeSelectionWidget (
selectedFacility: selectedFacility ,
hmcCount: hmcCount . toString ( ) ,
hmgCount: hmgCount . toString ( ) ,
onitemClicked: ( selectedValue ) {
onFacilityClicked ( selectedValue ) ;
} ,
) ,
SizedBox ( height: 21. h ) ,
SizedBox (
height: MediaQuery . sizeOf ( context ) . height * . 4 ,
child: ListView . separated (
itemBuilder: ( _ , index )
{
var hospital = displayList ? [ index ] ;
return HospitalListItem (
hospitalData: hospital ,
isLocationEnabled: sortByLocation ,
) . onPress ( ( ) {
onHospitalClicked ( hospital ! ) ;
} ) ; } ,
separatorBuilder: ( _ , __ ) = > SizedBox (
height: 16. h ,
) ,
) ,
itemCount: displayList ? . length ? ? 0 ,
if ( onSortByLocationToggle ! = null ) SizedBox ( height: 8. h ) ,
) )
TypeSelectionWidget (
] ,
selectedFacility: selectedFacility ,
) ;
hmcCount: hmcCount . toString ( ) ,
hmgCount: hmgCount . toString ( ) ,
onitemClicked: ( selectedValue ) {
onFacilityClicked ( selectedValue ) ;
} ,
) ,
SizedBox ( height: 21. h ) ,
SizedBox (
height: MediaQuery . sizeOf ( context ) . height * . 4 ,
child: ListView . separated (
itemBuilder: ( _ , index ) {
var hospital = displayList ? [ index ] ;
return HospitalListItem (
hospitalData: hospital ,
isLocationEnabled: sortByLocation ,
) . onPress ( ( ) {
onHospitalClicked ( hospital ! ) ;
} ) ;
} ,
separatorBuilder: ( _ , __ ) = > SizedBox (
height: 16. h ,
) ,
itemCount: displayList ? . length ? ? 0 ,
) )
] ,
) ;
}
} ) ;
}
}
}
}