Merge branch 'master' into haroon_dev

# Conflicts:
#	lib/features/my_appointments/my_appointments_view_model.dart
#	lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart
#	lib/presentation/book_appointment/select_clinic_page.dart
#	lib/presentation/lab/lab_orders_page.dart
pull/72/head
haroon amjad 4 weeks ago
commit c0606fb530

@ -873,5 +873,6 @@
"historyFlowchart": "مخطط تدفق التاريخ", "historyFlowchart": "مخطط تدفق التاريخ",
"to": "إلى", "to": "إلى",
"startDate": "تاريخ البدء", "startDate": "تاريخ البدء",
"endDate": "تاريخ الانتهاء" "endDate": "تاريخ الانتهاء",
"walkin": "زيارة بدون موعد"
} }

@ -869,5 +869,7 @@
"regionAndLocation": "Region And Locations", "regionAndLocation": "Region And Locations",
"clearAllFilters": "Clear all filters", "clearAllFilters": "Clear all filters",
"filters": "Filters", "filters": "Filters",
"searchClinic": "Search Clinic" "searchClinic": "Search Clinic",
"walkin": "Walk In"
} }

@ -0,0 +1,17 @@
import 'package:hmg_patient_app_new/core/app_assets.dart';
enum AppointmentListingFilters{
WALKIN("walkin", AppAssets.walkin_appointment_icon),
BOOKED("booked", AppAssets.calendar),
CONFIRMED("confirmed", AppAssets.calendar),
ARRIVED("arrived", AppAssets.calendar),
LIVECARE("livecare", AppAssets.small_livecare_icon),
DATESELECTION("",AppAssets.calendar, trailingIcon: AppAssets.arrow_down);
final String labelText;
final String leadingIcon;
final String trailingIcon;
const AppointmentListingFilters(this.labelText, this.leadingIcon,
{this.trailingIcon = ""});
}

@ -1,13 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_share_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_share_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart';
import 'package:hmg_patient_app_new/features/my_appointments/utils/appointment_type.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart';
class MyAppointmentsViewModel extends ChangeNotifier { class MyAppointmentsViewModel extends ChangeNotifier {
int selectedTabIndex = 0; int selectedTabIndex = 0;
int previouslySelectedTab = -1;
MyAppointmentsRepo myAppointmentsRepo; MyAppointmentsRepo myAppointmentsRepo;
ErrorHandlerService errorHandlerService; ErrorHandlerService errorHandlerService;
@ -20,7 +24,14 @@ class MyAppointmentsViewModel extends ChangeNotifier {
bool isAppointmentDataToBeLoaded = true; bool isAppointmentDataToBeLoaded = true;
List<AppointmentListingFilters> availableFilters = [];
List<AppointmentListingFilters>? selectedFilter = [];
bool isDateFilterSelected = false;
DateTime? start =null;
DateTime? end =null;
List<PatientAppointmentHistoryResponseModel> patientAppointmentsHistoryList = []; List<PatientAppointmentHistoryResponseModel> patientAppointmentsHistoryList = [];
List<PatientAppointmentHistoryResponseModel> filteredAppointmentList = [];
List<PatientAppointmentHistoryResponseModel> patientUpcomingAppointmentsHistoryList = []; List<PatientAppointmentHistoryResponseModel> patientUpcomingAppointmentsHistoryList = [];
List<PatientAppointmentHistoryResponseModel> patientArrivedAppointmentsHistoryList = []; List<PatientAppointmentHistoryResponseModel> patientArrivedAppointmentsHistoryList = [];
@ -37,6 +48,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
MyAppointmentsViewModel({required this.myAppointmentsRepo, required this.errorHandlerService, required this.appState}); MyAppointmentsViewModel({required this.myAppointmentsRepo, required this.errorHandlerService, required this.appState});
void onTabChange(int index) { void onTabChange(int index) {
previouslySelectedTab = selectedTabIndex;
selectedTabIndex = index; selectedTabIndex = index;
notifyListeners(); notifyListeners();
} }
@ -140,10 +152,43 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientAppointmentsHistoryList.addAll(patientUpcomingAppointmentsHistoryList); patientAppointmentsHistoryList.addAll(patientUpcomingAppointmentsHistoryList);
patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList); patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList);
filteredAppointmentList.addAll(patientAppointmentsHistoryList);
print('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}'); print('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}');
print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}'); print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}');
print('All Appointments: ${patientAppointmentsHistoryList.length}'); print('All Appointments: ${patientAppointmentsHistoryList.length}');
getFiltersForSelectedAppointmentList(filteredAppointmentList);
}
void getFiltersForSelectedAppointmentList(
List<PatientAppointmentHistoryResponseModel> filteredAppointmentList) {
availableFilters.clear();
if (filteredAppointmentList.isEmpty == true) return;
availableFilters.add(AppointmentListingFilters.DATESELECTION);
if (filteredAppointmentList
.any((element) => element.isLiveCareAppointment == true)) {
availableFilters.add(AppointmentListingFilters.LIVECARE);
}
if (filteredAppointmentList
.any((element) => element.isLiveCareAppointment == false)) {
availableFilters.add(AppointmentListingFilters.WALKIN);
}
if (filteredAppointmentList
.any((element) => AppointmentType.isArrived(element) == true)) {
availableFilters.add(AppointmentListingFilters.ARRIVED);
}
if (filteredAppointmentList
.any((element) => AppointmentType.isBooked(element) == true)) {
availableFilters.add(AppointmentListingFilters.BOOKED);
}
if (filteredAppointmentList
.any((element) => AppointmentType.isConfirmed(element) == true)) {
availableFilters.add(AppointmentListingFilters.CONFIRMED);
}
notifyListeners();
} }
Future<void> getPatientShareAppointment(int projectID, int clinicID, String appointmentNo, bool isLiveCareAppointment, {Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getPatientShareAppointment(int projectID, int clinicID, String appointmentNo, bool isLiveCareAppointment, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
@ -352,6 +397,116 @@ class MyAppointmentsViewModel extends ChangeNotifier {
); );
} }
void updateListWRTTab(int index) {
isDateFilterSelected = false;
selectedFilter = [];
// if(previouslySelectedTab == selectedTabIndex ) return;
switch (index) {
case 0:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientAppointmentsHistoryList);
break;
case 1:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientUpcomingAppointmentsHistoryList);
break;
case 2:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientArrivedAppointmentsHistoryList);
break;
}
getFiltersForSelectedAppointmentList(filteredAppointmentList);
notifyListeners();
}
void setSelectedFilter(AppointmentListingFilters availableFilter) {
if (selectedFilter?.contains(availableFilter) == true) {
selectedFilter?.remove(availableFilter);
notifyListeners();
return;
}
selectedFilter?.add(availableFilter) ;
notifyListeners();
}
void getSelectedDateRange(DateTime? start, DateTime? end) {
this.start = start;
this.end = end;
isDateFilterSelected = true;
List<PatientAppointmentHistoryResponseModel> sourceList = [];
if (selectedTabIndex == 0) {
sourceList = patientAppointmentsHistoryList;
} else if (selectedTabIndex == 1) {
sourceList = patientUpcomingAppointmentsHistoryList;
} else if (selectedTabIndex == 2) {
sourceList = patientArrivedAppointmentsHistoryList;
}
// if (isDateFilterSelected) sourceList = filteredAppointmentList;
if (start == null && end == null) {
isDateFilterSelected = false;
filteredAppointmentList.clear();
sourceList.forEach((element) {
if (isUnderFilter(element)) {
filteredAppointmentList.add(element);
}
});
filteredAppointmentList.addAll(sourceList);
} else {
filteredAppointmentList.clear();
sourceList.forEach((element) {
try {
var dateTime = DateUtil.convertStringToDate(element.appointmentDate);
if (start != null && end == null) {
if (dateTime.isAtSameMomentAs(start)) {
if (isUnderFilter(element)) {
filteredAppointmentList.add(element);
}
}
} else if (start != null && end != null) {
if ((dateTime.isAfter(start)) && (dateTime.isBefore(end))) {
if (isUnderFilter(element)) {
filteredAppointmentList.add(element);
}
}
}
} catch (e) {}
});
}
notifyListeners();
}
void filterTheListAsPerSelection() {
getSelectedDateRange(start, end);
}
bool isUnderFilter(PatientAppointmentHistoryResponseModel element) {
bool isUnderTheFilter = false;
if (selectedFilter == null || selectedFilter!.isEmpty) return true;
int count = 0;
for (var filter in selectedFilter ?? []) {
switch (filter) {
case AppointmentListingFilters.WALKIN:
if (element.isLiveCareAppointment == false) return true;
case AppointmentListingFilters.BOOKED:
if (AppointmentType.isBooked(element))return true;
case AppointmentListingFilters.CONFIRMED:
if (AppointmentType.isConfirmed(element))return true;
case AppointmentListingFilters.ARRIVED:
if (AppointmentType.isArrived(element))return true;
case AppointmentListingFilters.LIVECARE:
if (element.isLiveCareAppointment == true) return true;
case AppointmentListingFilters.DATESELECTION:
}
}
return false;
}
Future<void> getTamaraInstallmentsDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getTamaraInstallmentsDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await myAppointmentsRepo.getTamaraInstallmentsDetails(); final result = await myAppointmentsRepo.getTamaraInstallmentsDetails();

@ -863,6 +863,7 @@ abstract class LocaleKeys {
static const clearAllFilters = 'clearAllFilters'; static const clearAllFilters = 'clearAllFilters';
static const filters = 'filters'; static const filters = 'filters';
static const searchClinic = 'searchClinic'; static const searchClinic = 'searchClinic';
static const walkin = 'walkin';
static const normal = 'normal'; static const normal = 'normal';
static const attention = 'attention'; static const attention = 'attention';
static const monitor = 'monitor'; static const monitor = 'monitor';

@ -15,7 +15,6 @@ import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_mode
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart';
import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/history/lab_history_viewmodel.dart'; import 'package:hmg_patient_app_new/features/lab/history/lab_history_viewmodel.dart';
import 'package:hmg_patient_app_new/features/lab/lab_range_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart';
@ -28,6 +27,7 @@ import 'package:hmg_patient_app_new/routes/app_routes.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/app_theme.dart'; import 'package:hmg_patient_app_new/theme/app_theme.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart' show DateRangeSelectorRangeViewModel;
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart'; import 'package:provider/single_child_widget.dart';
@ -163,8 +163,8 @@ void main() async {
navigationService: getIt(), appState: getIt())), navigationService: getIt(), appState: getIt())),
ChangeNotifierProvider<LabHistoryViewModel>( ChangeNotifierProvider<LabHistoryViewModel>(
create: (_) => LabHistoryViewModel()), create: (_) => LabHistoryViewModel()),
ChangeNotifierProvider<LabRangeViewModel>( ChangeNotifierProvider<DateRangeSelectorRangeViewModel>(
create: (_) => LabRangeViewModel()) , create: (_) => DateRangeSelectorRangeViewModel()) ,
ChangeNotifierProvider<DoctorFilterViewModel>( ChangeNotifierProvider<DoctorFilterViewModel>(
create: (_) => DoctorFilterViewModel()) create: (_) => DoctorFilterViewModel())
], child: MyApp()), ], child: MyApp()),

@ -8,19 +8,26 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/features/my_appointments/models/appointemnet_filters.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.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/AppointmentFilter.dart';
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/date_range_calender.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart'; import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../widgets/common_bottom_sheet.dart'
show showCommonBottomSheetWithoutHeight;
class MyAppointmentsPage extends StatefulWidget { class MyAppointmentsPage extends StatefulWidget {
const MyAppointmentsPage({super.key}); const MyAppointmentsPage({super.key});
@ -61,6 +68,8 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
], ],
onTabChange: (index) { onTabChange: (index) {
myAppointmentsViewModel.onTabChange(index); myAppointmentsViewModel.onTabChange(index);
myAppointmentsViewModel.updateListWRTTab(index);
context.read<DateRangeSelectorRangeViewModel>().flush();
}, },
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) { Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
@ -74,218 +83,147 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
} }
Widget getSelectedTabData(int index, MyAppointmentsViewModel myAppointmentsVM) { Widget getSelectedTabData(int index, MyAppointmentsViewModel myAppointmentsVM) {
switch (index) { return getAppointList(
case 0: myAppointmentsVM, myAppointmentsVM.filteredAppointmentList);
//All Appointments Tab Data }
return Column(
crossAxisAlignment: CrossAxisAlignment.start, Widget getAppointList(MyAppointmentsViewModel myAppointmentsVM,
children: [ List<PatientAppointmentHistoryResponseModel> filteredAppointmentList) {
// Expandable list return Column(
ListView.separated( crossAxisAlignment: CrossAxisAlignment.start,
padding: EdgeInsets.only(top: 24.h), children: [
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), Visibility(
itemCount: myAppointmentsVM.isMyAppointmentsLoading visible: myAppointmentsVM.availableFilters.isNotEmpty,
? 5 child: getAppointmentFilters(myAppointmentsVM)),
: myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty ListView.separated(
? myAppointmentsVM.patientAppointmentsHistoryList.length padding: EdgeInsets.only(top: 24.h),
: 1, shrinkWrap: true,
itemBuilder: (context, index) { physics: NeverScrollableScrollPhysics(),
return myAppointmentsVM.isMyAppointmentsLoading itemCount: myAppointmentsVM.isMyAppointmentsLoading
? Container( ? 5
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), : filteredAppointmentList.isNotEmpty
child: AppointmentCard( ? filteredAppointmentList.length
patientAppointmentHistoryResponseModel: PatientAppointmentHistoryResponseModel(), : 1,
myAppointmentsViewModel: myAppointmentsViewModel, itemBuilder: (context, index) {
isLoading: true, return myAppointmentsVM.isMyAppointmentsLoading
isFromHomePage: false, ? Container(
), decoration: RoundedRectangleBorder()
).paddingSymmetrical(24.h, 0.h) .toSmoothCornerDecoration(
: myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty color: AppColors.whiteColor,
? AnimationConfiguration.staggeredList( borderRadius: 24.h,
position: index, hasShadow: true),
duration: const Duration(milliseconds: 500), child: AppointmentCard(
child: SlideAnimation( patientAppointmentHistoryResponseModel:
verticalOffset: 100.0, PatientAppointmentHistoryResponseModel(),
child: FadeInAnimation( myAppointmentsViewModel: myAppointmentsViewModel,
child: AnimatedContainer( isLoading: true,
duration: Duration(milliseconds: 300), isFromHomePage: false,
curve: Curves.easeInOut, ),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), ).paddingSymmetrical(24.h, 0.h)
child: AppointmentCard( : filteredAppointmentList.isNotEmpty
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index], ? AnimationConfiguration.staggeredList(
myAppointmentsViewModel: myAppointmentsViewModel, position: index,
isLoading: false, duration: const Duration(milliseconds: 500),
isFromHomePage: false, child: SlideAnimation(
), verticalOffset: 100.0,
).paddingSymmetrical(24.h, 0.h), child: FadeInAnimation(
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.h,
hasShadow: true),
child: AppointmentCard(
patientAppointmentHistoryResponseModel:
filteredAppointmentList[index],
myAppointmentsViewModel:
myAppointmentsViewModel,
isLoading: false,
isFromHomePage: false,
), ),
), ).paddingSymmetrical(24.h, 0.h),
) ),
: Utils.getNoDataWidget( ),
context, )
noDataText: "You don't have any appointments yet.".needTranslation, : Utils.getNoDataWidget(
callToActionButton: CustomButton( context,
text: LocaleKeys.bookAppo.tr(context: context), noDataText: "You don't have any appointments yet."
onPressed: () { .needTranslation,
Navigator.of(context).push( callToActionButton: CustomButton(
CustomPageRoute( text: LocaleKeys.bookAppo.tr(context: context),
page: BookAppointmentPage(), onPressed: () {
), Navigator.of(context).push(
); CustomPageRoute(
}, page: BookAppointmentPage(),
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B),
fontSize: 14,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40,
icon: AppAssets.add_icon,
iconColor: AppColors.primaryRedColor,
).paddingSymmetrical(48.h, 0.h),
);
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
),
],
);
case 1:
//Upcoming Appointments Tab Data
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Expandable list
ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: myAppointmentsVM.isMyAppointmentsLoading
? 5
: myAppointmentsVM.patientUpcomingAppointmentsHistoryList.isNotEmpty
? myAppointmentsVM.patientUpcomingAppointmentsHistoryList.length
: 1,
itemBuilder: (context, index) {
return myAppointmentsVM.isMyAppointmentsLoading
? const MoviesShimmerWidget().paddingSymmetrical(24.h, 0.h)
: myAppointmentsVM.patientUpcomingAppointmentsHistoryList.isNotEmpty
? AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 500),
child: SlideAnimation(
verticalOffset: 100.0,
child: FadeInAnimation(
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
child: AppointmentCard(
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientUpcomingAppointmentsHistoryList[index],
myAppointmentsViewModel: myAppointmentsViewModel,
),
).paddingSymmetrical(24.h, 0.h),
), ),
), );
) },
: Utils.getNoDataWidget( backgroundColor: Color(0xffFEE9EA),
context, borderColor: Color(0xffFEE9EA),
noDataText: "You don't have any appointments yet.".needTranslation, textColor: Color(0xffED1C2B),
callToActionButton: CustomButton( fontSize: 14,
text: LocaleKeys.bookAppo.tr(context: context), fontWeight: FontWeight.w500,
onPressed: () { borderRadius: 12,
Navigator.of(context).push( padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
CustomPageRoute( height: 40,
page: BookAppointmentPage(), icon: AppAssets.add_icon,
), iconColor: AppColors.primaryRedColor,
); ).paddingSymmetrical(48.h, 0.h),
}, );
backgroundColor: Color(0xffFEE9EA), },
borderColor: Color(0xffFEE9EA), separatorBuilder: (BuildContext cxt, int index) =>
textColor: Color(0xffED1C2B), SizedBox(height: 16.h),
fontSize: 14, ),
fontWeight: FontWeight.w500, ],
borderRadius: 12, );
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), }
height: 40,
icon: AppAssets.add_icon, Widget getAppointmentFilters(MyAppointmentsViewModel myAppointmentsVM) {
iconColor: AppColors.primaryRedColor, return SizedBox(
).paddingSymmetrical(48.h, 0.h), height: 56.h,
); child: Row(
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
),
],
);
case 2:
//Completed Appointments Tab Data
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Expandable list Expanded(
ListView.separated( child: ListView.separated(
shrinkWrap: true, separatorBuilder: (_, index) => SizedBox(
physics: NeverScrollableScrollPhysics(), width: 8.h,
itemCount: myAppointmentsVM.isMyAppointmentsLoading ),
? 5 scrollDirection: Axis.horizontal,
: myAppointmentsVM.patientArrivedAppointmentsHistoryList.isNotEmpty itemCount: myAppointmentsVM.availableFilters.length,
? myAppointmentsVM.patientArrivedAppointmentsHistoryList.length itemBuilder: (_, index) => AppointmentFilters(
: 1, selectedFilter: myAppointmentsVM.selectedFilter,
itemBuilder: (context, index) { item: myAppointmentsVM.availableFilters[index],
return myAppointmentsVM.isMyAppointmentsLoading onClicked: () {
? const MoviesShimmerWidget().paddingSymmetrical(24.h, 0.h) if (myAppointmentsVM.availableFilters[index] ==
: myAppointmentsVM.patientArrivedAppointmentsHistoryList.isNotEmpty AppointmentListingFilters.DATESELECTION) {
? AnimationConfiguration.staggeredList( showCommonBottomSheetWithoutHeight(
position: index, title: "Set The Date Range".needTranslation,
duration: const Duration(milliseconds: 500), context,
child: SlideAnimation( child: DateRangeSelector(
verticalOffset: 100.0, onRangeSelected: (start, end) {
child: FadeInAnimation( // if (start != null) {
child: AnimatedContainer( myAppointmentsVM.getSelectedDateRange(
duration: Duration(milliseconds: 300), start, end);
curve: Curves.easeInOut, // }
margin: EdgeInsets.symmetric(vertical: 8.h), },
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
child: AppointmentCard(
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientArrivedAppointmentsHistoryList[index],
myAppointmentsViewModel: myAppointmentsViewModel,
),
).paddingSymmetrical(24.h, 0.h),
), ),
), isFullScreen: false,
) isCloseButtonVisible: true,
: Utils.getNoDataWidget( callBackFunc: () {},
context, );
noDataText: "You don't have any appointments yet.".needTranslation, } else {
callToActionButton: CustomButton( myAppointmentsVM.setSelectedFilter(
text: LocaleKeys.bookAppo.tr(context: context), myAppointmentsVM.availableFilters[index]);
onPressed: () { myAppointmentsVM.filterTheListAsPerSelection();
Navigator.of(context).push( }
CustomPageRoute( },
page: BookAppointmentPage(), )),
),
);
},
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B),
fontSize: 14,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40,
icon: AppAssets.add_icon,
iconColor: AppColors.primaryRedColor,
).paddingSymmetrical(48.h, 0.h),
);
},
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
), ),
], ],
); )).paddingOnly(top: 24.h, left: 24.h, right: 24.h);
default:
return Container();
}
} }
} }

@ -0,0 +1,48 @@
import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension;
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:smooth_corner/smooth_corner.dart';
class AppointmentFilters extends StatelessWidget {
final AppointmentListingFilters item;
final List<AppointmentListingFilters>? selectedFilter;
final VoidCallback onClicked;
const AppointmentFilters(
{super.key,
required this.item,
required this.onClicked,
required this.selectedFilter});
@override
Widget build(BuildContext context) {
return AppCustomChipWidget(
backgroundColor: selectedFilter?.contains(item) == true?AppColors.chipSecondaryLightRedColor:AppColors.whiteColor,
icon: item.leadingIcon,
textColor: selectedFilter?.contains(item) == true
? AppColors.chipPrimaryRedBorderColor: AppColors.blackColor,
labelText: item.labelText.isNotEmpty?item.labelText.tr():"",
iconHasColor: true,
iconColor: selectedFilter?.contains(item) == true
? AppColors.chipPrimaryRedBorderColor:AppColors.blackColor,
iconSize: 16,
deleteIcon: item.trailingIcon,
labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: 0.h),
padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 8.h),
deleteIconSize: Size(18.h, 18.h),
shape: SmoothRectangleBorder(
borderRadius: BorderRadius.circular(10 ),
smoothness: 10,
side: BorderSide(
color: selectedFilter?.contains(item) == true
? AppColors.chipPrimaryRedBorderColor
: AppColors.borderGrayColor,
width: 1),
)).onPress(onClicked);
}
}

@ -378,7 +378,15 @@ class _SelectClinicPageState extends State<SelectClinicPage> {
return HospitalBottomSheetBody(); return HospitalBottomSheetBody();
} }
if (data.bottomSheetState == AppointmentViaRegionState.DOCTOR_SELECTION) { if (data.bottomSheetState == AppointmentViaRegionState.DOCTOR_SELECTION) {
bookAppointmentsViewModel.setProjectID(regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID.toString()); //if the region screen is opened for the dental clinic thenthe project id will be in the hospital list as the list is formed form the get project api
var id = "";
if (data.regionBottomSheetType == RegionBottomSheetType.REGION_FOR_DENTAL_AND_LASER) {
id = regionalViewModel.selectedHospital?.hospitalList?.first?.iD?.toString() ?? "";
} else {
id = regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first?.projectID?.toString() ?? "";
}
bookAppointmentsViewModel.setProjectID(id);
return SizedBox.shrink();
} }
else { else {
return SizedBox.shrink(); return SizedBox.shrink();

@ -32,7 +32,6 @@ import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.
import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_calender.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart'; import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart';
import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart';

File diff suppressed because one or more lines are too long

@ -6,11 +6,11 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/features/lab/lab_range_view_model.dart' show LabRangeViewModel; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.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/lab/lab_results/lab_result_calender.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/date_range_calender.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_list_item.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_list_item.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/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
@ -135,7 +135,7 @@ class LabResultDetails extends StatelessWidget {
], ],
)); ));
Widget LabGraph(BuildContext context) => Consumer<LabRangeViewModel>( Widget LabGraph(BuildContext context) => Consumer<DateRangeSelectorRangeViewModel>(
builder: (_, model, ___) => Consumer<LabViewModel>( builder: (_, model, ___) => Consumer<LabViewModel>(
builder: (_, labmodel, ___) => Container( builder: (_, labmodel, ___) => Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
@ -181,7 +181,7 @@ class LabResultDetails extends StatelessWidget {
showCommonBottomSheetWithoutHeight( showCommonBottomSheetWithoutHeight(
title: LocaleKeys.setTheDateRange.tr(), title: LocaleKeys.setTheDateRange.tr(),
context, context,
child: LabResultCalender( child: DateRangeSelector(
onRangeSelected: (start, end) { onRangeSelected: (start, end) {
// if (start != null) { // if (start != null) {
@ -229,7 +229,7 @@ class LabResultDetails extends StatelessWidget {
); );
} }
Widget historyBody(LabRangeViewModel model, LabViewModel labmodel) { Widget historyBody(DateRangeSelectorRangeViewModel model, LabViewModel labmodel) {
if(model.isGraphVisible){ if(model.isGraphVisible){
var graphColor = labmodel.getColor(recentLabResult.calculatedResultFlag??"N"); var graphColor = labmodel.getColor(recentLabResult.calculatedResultFlag??"N");
return CustomGraph( return CustomGraph(
@ -283,7 +283,7 @@ class LabResultDetails extends StatelessWidget {
} }
} }
Widget labHistoryList(LabRangeViewModel model, LabViewModel labmodel) { Widget labHistoryList(DateRangeSelectorRangeViewModel model, LabViewModel labmodel) {
return SizedBox( return SizedBox(
height: labmodel.filteredGraphValues.length<3?labmodel.filteredGraphValues.length*64:180.h, height: labmodel.filteredGraphValues.length<3?labmodel.filteredGraphValues.length*64:180.h,
child: ListView.separated( child: ListView.separated(

@ -29,6 +29,7 @@ class AppColors {
static const Color bgRedLightColor = Color(0xFFFEE9EA); static const Color bgRedLightColor = Color(0xFFFEE9EA);
static const Color bgGreenColor = Color(0xFF18C273); static const Color bgGreenColor = Color(0xFF18C273);
static const Color textColor = Color(0xFF2E3039); static const Color textColor = Color(0xFF2E3039);
static const Color borderGrayColor = Color(0x332E3039);
static const Color textColorLight = Color(0xFF5E5E5E); static const Color textColorLight = Color(0xFF5E5E5E);
static const Color borderOnlyColor = Color(0xFF2E3039); static const Color borderOnlyColor = Color(0xFF2E3039);
static const Color chipBorderColorOpacity20 = Color(0x332E3039); static const Color chipBorderColorOpacity20 = Color(0x332E3039);

@ -24,6 +24,7 @@ class AppCustomChipWidget extends StatelessWidget {
this.deleteIconColor = AppColors.textColor, this.deleteIconColor = AppColors.textColor,
this.deleteIconHasColor = false, this.deleteIconHasColor = false,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.labelPadding ,
}); });
final String? labelText; final String? labelText;
@ -40,6 +41,7 @@ class AppCustomChipWidget extends StatelessWidget {
final bool deleteIconHasColor; final bool deleteIconHasColor;
final OutlinedBorder? shape; final OutlinedBorder? shape;
final EdgeInsets? padding; final EdgeInsets? padding;
final EdgeInsetsDirectional? labelPadding;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -62,7 +64,7 @@ class AppCustomChipWidget extends StatelessWidget {
// padding: EdgeInsets.all(0.0), // padding: EdgeInsets.all(0.0),
padding: padding, padding: padding,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
labelPadding: EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h), labelPadding: labelPadding??EdgeInsetsDirectional.only(start: 0.h, end: deleteIcon?.isNotEmpty == true ? 2.h : 8.h),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
shape: shape ?? shape: shape ??
SmoothRectangleBorder( SmoothRectangleBorder(

@ -7,32 +7,32 @@ import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/features/lab/lab_range_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/Range.dart'; import 'package:hmg_patient_app_new/features/lab/models/Range.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/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart' show DateRangeSelectorRangeViewModel;
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'package:syncfusion_flutter_datepicker/datepicker.dart';
typedef OnRangeSelected = void Function(DateTime? start, DateTime? end); typedef OnRangeSelected = void Function(DateTime? start, DateTime? end);
class LabResultCalender extends StatefulWidget { class DateRangeSelector extends StatefulWidget {
final OnRangeSelected onRangeSelected; final OnRangeSelected onRangeSelected;
const LabResultCalender({super.key, required this.onRangeSelected}); const DateRangeSelector({super.key, required this.onRangeSelected});
@override @override
State<LabResultCalender> createState() => _LabResultCalenderState(); State<DateRangeSelector> createState() => _DateRangeSelectorState();
} }
class _LabResultCalenderState extends State<LabResultCalender> { class _DateRangeSelectorState extends State<DateRangeSelector> {
late DateRangePickerController _calendarController; late DateRangePickerController _calendarController;
DateTime? start; DateTime? start;
DateTime? end; DateTime? end;
late LabRangeViewModel model; late DateRangeSelectorRangeViewModel model;
@override @override
void initState() { void initState() {
_calendarController = DateRangePickerController(); _calendarController = DateRangePickerController();
@ -44,13 +44,17 @@ class _LabResultCalenderState extends State<LabResultCalender> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
model = Provider.of<LabRangeViewModel>(context); model = Provider.of<DateRangeSelectorRangeViewModel>(context);
_calendarController.selectedRange = PickerDateRange(model.fromDate,model.toDate);
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 0.h), padding: EdgeInsets.symmetric(horizontal: 0.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Consumer<LabRangeViewModel>( Consumer<DateRangeSelectorRangeViewModel>(
builder: (_, model, __) => selectionChip(model), builder: (_, model, __) => selectionChip(model),
).paddingOnly(bottom: 16.h), ).paddingOnly(bottom: 16.h),
Container( Container(
@ -135,13 +139,19 @@ class _LabResultCalenderState extends State<LabResultCalender> {
), ),
onSelectionChanged: onSelectionChanged:
(DateRangePickerSelectionChangedArgs args) { (DateRangePickerSelectionChangedArgs args) {
print("the value is ${args.value}");
if (args.value is PickerDateRange) { if (args.value is PickerDateRange) {
final PickerDateRange range = args.value; final PickerDateRange range = args.value;
start = range.startDate; start = range.startDate;
end = range.endDate; end = range.endDate;
model.fromDate = start; model.fromDate = start;
model.toDate = end; model.toDate = end;
model.resetCurrentlySelectedRange(); if(end == null) {
scheduleMicrotask((){
model.resetCurrentlySelectedRange();
});
}
} }
}, },
), ),
@ -151,7 +161,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
), ),
Row( Row(
children: [ children: [
Consumer<LabRangeViewModel>( Consumer<DateRangeSelectorRangeViewModel>(
builder: (_, model, __) => Visibility( builder: (_, model, __) => Visibility(
visible: (model.fromDate != null || model.toDate != null), visible: (model.fromDate != null || model.toDate != null),
child: Expanded( child: Expanded(
@ -164,6 +174,8 @@ class _LabResultCalenderState extends State<LabResultCalender> {
_calendarController.selectedRange = null; _calendarController.selectedRange = null;
_calendarController.selectedDate = null; _calendarController.selectedDate = null;
model.flush(); model.flush();
Navigator.of(context).pop();
widget.onRangeSelected(null, null);
}, },
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,
@ -203,7 +215,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
} }
fromDateComponent() { fromDateComponent() {
return Consumer<LabRangeViewModel>( return Consumer<DateRangeSelectorRangeViewModel>(
builder: (_, model, __) { builder: (_, model, __) {
return displayDate(LocaleKeys.startDate.tr(), return displayDate(LocaleKeys.startDate.tr(),
model.getDateString(model.fromDate), model.fromDate == null); model.getDateString(model.fromDate), model.fromDate == null);
@ -212,7 +224,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
} }
toDateComponent() { toDateComponent() {
return Consumer<LabRangeViewModel>( return Consumer<DateRangeSelectorRangeViewModel>(
builder: (_, model, __) { builder: (_, model, __) {
return displayDate(LocaleKeys.endDate.tr(), return displayDate(LocaleKeys.endDate.tr(),
model.getDateString(model.toDate), model.toDate == null); model.getDateString(model.toDate), model.toDate == null);
@ -254,7 +266,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
), ),
); );
selectionChip(LabRangeViewModel model) { selectionChip(DateRangeSelectorRangeViewModel model) {
return Row( return Row(
spacing: 8.h, spacing: 8.h,
children: [ children: [
@ -311,6 +323,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
_calendarController.selectedRange = null; _calendarController.selectedRange = null;
model.currentlySelectedRange = Range.LAST_6MONTH; model.currentlySelectedRange = Range.LAST_6MONTH;
model.calculateDatesFromRange(); model.calculateDatesFromRange();
}), }),
AppCustomChipWidget( AppCustomChipWidget(
labelText: "Year ${model.getCurrentYear}", labelText: "Year ${model.getCurrentYear}",
@ -329,6 +342,7 @@ class _LabResultCalenderState extends State<LabResultCalender> {
_calendarController.selectedRange = null; _calendarController.selectedRange = null;
model.currentlySelectedRange = Range.THIS_YEAR; model.currentlySelectedRange = Range.THIS_YEAR;
model.calculateDatesFromRange(); model.calculateDatesFromRange();
}), }),
], ],
); );

@ -2,7 +2,7 @@ import 'package:dartz/dartz.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/features/lab/models/Range.dart'; import 'package:hmg_patient_app_new/features/lab/models/Range.dart';
class LabRangeViewModel extends ChangeNotifier { class DateRangeSelectorRangeViewModel extends ChangeNotifier {
List months = [ List months = [
'Jan', 'Jan',
'Feb', 'Feb',
@ -24,8 +24,6 @@ class LabRangeViewModel extends ChangeNotifier {
set currentlySelectedRange(Range? value) { set currentlySelectedRange(Range? value) {
_currentlySelectedRange = value; _currentlySelectedRange = value;
notifyListeners();
} }
DateTime? _toDate; DateTime? _toDate;
@ -34,7 +32,7 @@ class LabRangeViewModel extends ChangeNotifier {
set toDate(DateTime? value) { set toDate(DateTime? value) {
_toDate = value; _toDate = value;
notifyListeners();
} }
DateTime? _fromDate; DateTime? _fromDate;
@ -43,11 +41,11 @@ class LabRangeViewModel extends ChangeNotifier {
set fromDate(DateTime? value) { set fromDate(DateTime? value) {
_fromDate = value; _fromDate = value;
notifyListeners();
} }
LabRangeViewModel(); DateRangeSelectorRangeViewModel();
get getCurrentYear => DateTime.now().year; get getCurrentYear => DateTime.now().year;
@ -65,6 +63,7 @@ class LabRangeViewModel extends ChangeNotifier {
_fromDate = DateTime(_toDate!.year, DateTime.january, 01); _fromDate = DateTime(_toDate!.year, DateTime.january, 01);
default: default:
} }
notifyListeners();
} }
getDateString(DateTime? date){ getDateString(DateTime? date){
@ -84,6 +83,7 @@ class LabRangeViewModel extends ChangeNotifier {
resetCurrentlySelectedRange(){ resetCurrentlySelectedRange(){
currentlySelectedRange = null; currentlySelectedRange = null;
notifyListeners();
} }
alterGraphVisibility(){ alterGraphVisibility(){
Loading…
Cancel
Save