feature/search_by_region #55

Merged
Haroon6138 merged 3 commits from feature/search_by_region into master 1 month ago

@ -849,6 +849,7 @@
"pleaseEnterEmail": "يرجى إدخال البريد الإلكتروني",
"pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح",
"selectCountry": "اختر الدولة",
"forLoginVerification": "للتحقق من تسجيل الدخول"
"forLoginVerification": "للتحقق من تسجيل الدخول",
"searchHospital": "بحث في المستشفى"
}

@ -845,5 +845,6 @@
"pleaseEnterAValidEmailFormat": "Please enter a valid email format",
"selectCountry": "Select Country",
"forLoginVerification": "for login verification",
"lastLoginBy": "Last login by"
"lastLoginBy": "Last login by",
"searchHospital": "Search Hospital"
}

@ -22,7 +22,7 @@ extension WidgetExtensions on Widget {
Widget paddingSymmetrical(double horizontal, double vertical) => Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this);
Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
Padding(padding: EdgeInsetsDirectional.only(start: left, end: right, top: top, bottom: bottom), child: this);
Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);

@ -414,11 +414,6 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
Future<void> getRegionMappedProjectList() async {
//todo handle the case in the location is switch on
// if(hospitalList != null && hospitalList!.registeredDoctorMap != null && hospitalList!.registeredDoctorMap!.isNotEmpty){
// filteredHospitalList = hospitalList;
// return;
// }
isRegionListLoading = true;
notifyListeners();
final result = await bookAppointmentsRepo.getProjectList();
@ -432,7 +427,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
var projectList = apiResponse.data!;
hospitalList = await DoctorMapper.getMappedHospitals(projectList,
isArabic: false,
isArabic: _appState.isArabic(),
lat: _appState.userLat,
lng: _appState.userLong,
);

@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart' show ChangeNotifier;
import 'package:hmg_patient_app_new/core/app_state.dart' show AppState;
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
@ -20,8 +21,9 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier {
final NavigationService navigationService;
AppointmentViaRegionState bottomSheetState =
AppointmentViaRegionState.REGION_SELECTION;
final AppState appState;
AppointmentViaRegionViewmodel({required this.navigationService});
AppointmentViaRegionViewmodel({required this.navigationService,required this.appState});
void setSelectedRegionId(String? regionId) {
selectedRegionId = regionId;
@ -69,4 +71,6 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier {
void setHospitalModel(PatientDoctorAppointmentList? hospital) {
selectedHospital = hospital;
}
bool get isArabic => appState.isArabic();
}

@ -848,5 +848,6 @@ abstract class LocaleKeys {
static const pleaseEnterAValidEmailFormat = 'pleaseEnterAValidEmailFormat';
static const selectCountry = 'selectCountry';
static const forLoginVerification = 'forLoginVerification';
static const searchHospital = 'searchHospital';
}

@ -147,8 +147,8 @@ void main() async {
),
),
ChangeNotifierProvider<AppointmentViaRegionViewmodel>(
create: (_) =>
AppointmentViaRegionViewmodel(navigationService: getIt()))
create: (_) => AppointmentViaRegionViewmodel(
navigationService: getIt(), appState: getIt()))
], child: MyApp()),
),
);

@ -38,7 +38,7 @@ class FacilityTypeSelectionWidget extends StatelessWidget {
),
),
Text(
LocaleKeys.selectFacilitiesSubTitle,
LocaleKeys.selectFacilitiesSubTitle.tr(),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
@ -55,9 +55,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget {
}),
).onPress(
() {
regionalViewModel.setFacility(FacilitySelection.HMG.name);
regionalViewModel.setBottomSheetState(
AppointmentViaRegionState.HOSPITAL_SELECTION);
if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmgSize != 0) {
regionalViewModel.setFacility(FacilitySelection.HMG.name);
regionalViewModel.setBottomSheetState(
AppointmentViaRegionState.HOSPITAL_SELECTION);
}
},
),
SizedBox(height: 16.h),
@ -69,9 +71,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget {
"${bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize ?? 0}"
})).onPress(
() {
regionalViewModel.setFacility(FacilitySelection.HMC.name);
regionalViewModel.setBottomSheetState(
AppointmentViaRegionState.HOSPITAL_SELECTION);
if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize!= 0 ) {
regionalViewModel.setFacility(FacilitySelection.HMC.name);
regionalViewModel.setBottomSheetState(
AppointmentViaRegionState.HOSPITAL_SELECTION);
}
},
),
],

@ -50,7 +50,7 @@ class HospitalBottomSheetBody extends StatelessWidget {
SizedBox(height: 16.h),
TextInputWidget(
labelText: LocaleKeys.search.tr(),
hintText: "Search Hospital".tr(),
hintText: LocaleKeys.searchHospital.tr(),
controller: searchText,
onChange: (value) {
appointmentsViewModel.filterHospitalListByString(value, regionalViewModel.selectedRegionId , regionalViewModel.selectedFacilityType ==

@ -77,7 +77,7 @@ class RegionListItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Align(
alignment: Alignment.centerLeft,
alignment: AlignmentDirectional.centerStart,
child: Text(
title,
style: TextStyle(

@ -200,7 +200,11 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
void openRegionListBottomSheet(BuildContext context) {
regionalViewModel.flush();
// AppointmentViaRegionViewmodel? viewmodel = null;
showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) => getTitle(data)), isDismissible: false,
showCommonBottomSheetWithoutHeight(context,
title: "",
titleWidget: Consumer<AppointmentViaRegionViewmodel>(
builder: (_, data, __) => getTitle(data)),
isDismissible: false,
child: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) {
return getRegionalSelectionWidget(data);
}), callBackFunc: () {});
@ -234,9 +238,19 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
if (data.selectedRegionId == null) {
return LocaleKeys.selectRegion.tr().toText20(weight: FontWeight.w600);
} else {
return Utils.buildSvgWithAssets(icon: AppAssets.arrow_back, iconColor: Color(0xff2B353E)).onPress(() {
data.handleBackPress();
});
return
Transform.flip(
flipX: data.isArabic ? true : false,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back,
iconColor: Color(0xff2B353E),
fit: BoxFit.contain,
),
).onPress(() {
data.handleBackPress();
});
}
}
}

@ -72,9 +72,9 @@ class AppCustomChipWidget extends StatelessWidget {
// padding: EdgeInsets.all(0.0),
padding: padding,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
labelPadding: EdgeInsets.only(
left: -4.h,
right: deleteIcon?.isNotEmpty == true ? 2.h : 8.h),
labelPadding: EdgeInsetsDirectional.only(
start: -4.h,
end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h),
backgroundColor: backgroundColor,
shape: shape,
deleteIcon: deleteIcon?.isNotEmpty == true
@ -96,9 +96,9 @@ class AppCustomChipWidget extends StatelessWidget {
padding: EdgeInsets.all(0.0),
backgroundColor: backgroundColor,
shape: shape,
labelPadding: EdgeInsets.only(
left: 8.h,
right: deleteIcon?.isNotEmpty == true ? -2.h : 8.h),
labelPadding: EdgeInsetsDirectional.only(
start: 8.h,
end: deleteIcon?.isNotEmpty == true ? -2.h : 8.h),
deleteIcon: deleteIcon?.isNotEmpty == true
? Utils.buildSvgWithAssets(
icon: deleteIcon!,

Loading…
Cancel
Save