diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 80af2683..c06d8c37 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -103,8 +103,9 @@ class DoctorList { this.regionID, }); - DoctorList.fromJson(Map json, - {String region = '', bool isHMC = false}) { + DoctorList.fromJson( + Map json, + ) { clinicID = json['ClinicID']; appointmentNo = json['AppointmentNo']; clinicName = json['ClinicName']; @@ -152,8 +153,8 @@ class DoctorList { decimalDoctorRate = json['DecimalDoctorRate']; projectBottomName = json['ProjectNameBottom']; projectTopName = json['ProjectNameTop']; - this.isHMC = isHMC; - this.region = region; + this.isHMC = json["IsHMC"]; + this.region = json["RegionName"]; } Map toJson() { @@ -241,7 +242,7 @@ class PatientDoctorAppointmentListByRegion { List? hmcDoctorList = []; int hmcSize = 0; int hmgSize = 0; - double distance = double.infinity; + num distance = double.infinity; } class RegionList { diff --git a/lib/pages/BookAppointment/SearchResultsByRegion.dart b/lib/pages/BookAppointment/SearchResultsByRegion.dart index e7cbe538..563b9355 100644 --- a/lib/pages/BookAppointment/SearchResultsByRegion.dart +++ b/lib/pages/BookAppointment/SearchResultsByRegion.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -46,9 +45,11 @@ class SearchResultsByRegion extends StatelessWidget { addAutomaticKeepAlives: true, physics: BouncingScrollPhysics(), separatorBuilder: (context, index) { - return Container( - height: 12, - margin: EdgeInsets.only(left: 21, right: 21), + return Material( + color: Color(0xFFf5f5f5), + child: SizedBox( + height: 12, + ), ); }, itemBuilder: (context, index) { @@ -57,8 +58,10 @@ class SearchResultsByRegion extends StatelessWidget { .toList()[index] ?? ''; - print(' the key is $key'); return AppExpandableNotifier( + paddingValue: 10, + applyBackgroundToOnlyHeader: true, + completeHeaderColor: CustomColors.appBackgroudGrey2Color, headerWidget: RegionTitle( title: key, hmcCount: @@ -69,49 +72,64 @@ class SearchResultsByRegion extends StatelessWidget { showDropDownIconWithCustomHeader: true, isTitleSingleLine: false, isDoctorSearchResult: isDoctorSearchResult, + widgetColor: Color(0xFFF8F8F8), bodyWidget: Column( children: [ - AppExpandableNotifier( - headerWidget: HospitalTitle( - iconUrl: 'assets/images/svg/HMG.svg', - title: TranslationBase.of(context).hmgHospital, - isHMC: false, - itemCount: - "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", + Padding( + padding: const EdgeInsets.all(8.0), + child: AppExpandableNotifier( + paddingValue: 8, + applyBackgroundColor: false, + applyBackgroundToOnlyHeader: true, + completeHeaderColor: Colors.white, + headerRadius: BorderRadius.circular(16), + headerWidget: HospitalTitle( + iconUrl: 'assets/images/svg/HMG.svg', + title: TranslationBase.of(context).hmgHospital, + isHMC: false, + itemCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", + ), + showDropDownIconWithCustomHeader: true, + bodyWidget: HospitalBodyWidget( + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital + .registeredDoctorMap?[key]?.hmgDoctorList, + isLiveCareAppointment: isLiveCareAppointment, + isObGyneAppointment: isObGyneAppointment, + isDoctorNameSearch: isDoctorNameSearch, + isDoctorSearchResult: isDoctorSearchResult, + ), ), - showDropDownIconWithCustomHeader: true, - bodyWidget: HospitalBodyWidget( - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital - .registeredDoctorMap?[key]?.hmgDoctorList, - isLiveCareAppointment: isLiveCareAppointment, - isObGyneAppointment: isObGyneAppointment, - isDoctorNameSearch: isDoctorNameSearch, - isDoctorSearchResult: isDoctorSearchResult, - ), - ), - SizedBox( - height: 8, ), - AppExpandableNotifier( - headerWidget: HospitalTitle( - iconUrl: 'assets/images/svg/HMC.svg', - title: TranslationBase.of(context).hmcHospital, - isHMC: true, - itemCount: - "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", + Padding( + padding: const EdgeInsets.only( + bottom: 8.0, left: 8, right: 8), + child: AppExpandableNotifier( + paddingValue: 8, + applyBackgroundColor: false, + applyBackgroundToOnlyHeader: true, + completeHeaderColor: Colors.white, + headerRadius: BorderRadius.circular(16), + headerWidget: HospitalTitle( + iconUrl: 'assets/images/svg/HMC.svg', + title: TranslationBase.of(context).hmcHospital, + isHMC: true, + itemCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", + ), + showDropDownIconWithCustomHeader: true, + bodyWidget: HospitalBodyWidget( + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital + .registeredDoctorMap?[key]?.hmcDoctorList, + isLiveCareAppointment: isLiveCareAppointment, + isObGyneAppointment: isObGyneAppointment, + isDoctorNameSearch: isDoctorNameSearch, + isDoctorSearchResult: isDoctorSearchResult, + ), ), - showDropDownIconWithCustomHeader: true, - bodyWidget: HospitalBodyWidget( - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital - .registeredDoctorMap?[key]?.hmcDoctorList, - isLiveCareAppointment: isLiveCareAppointment, - isObGyneAppointment: isObGyneAppointment, - isDoctorNameSearch: isDoctorNameSearch, - isDoctorSearchResult: isDoctorSearchResult, - ), - ) + ), ], )); // return AppExpandableNotifier( @@ -193,6 +211,8 @@ class HospitalBodyWidget extends StatelessWidget { }, itemBuilder: (context, index) { return AppExpandableNotifier( + applyBackgroundColor: false, + widgetColor: CustomColors.appBackgroudGrey2Color, title: (patientDoctorAppointmentListHospital?[index].distanceInKMs != "0") ? patientDoctorAppointmentListHospital![index].filterName! + diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 158f2c49..af630471 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,5 +1,3 @@ -import "dart:collection"; - import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -12,10 +10,11 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResultsByRegion.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/doctor_response_mapper.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; @@ -638,42 +637,40 @@ class _SearchByClinicState extends State { List _patientDoctorAppointmentListHospital = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue!) : 0, nearestAppo, languageID, context).then((res) { + service + .getDoctorsList( + clinicID, + projectDropdownValue != "" ? int.parse(projectDropdownValue!) : 0, + nearestAppo, + languageID, + context) + .then((res) async { GifLoaderDialogUtils.hideDialog(context); + RegionList regionHospitalList = RegionList(); + if (res['MessageStatus'] == 1) { - setState(() { - if (res['DoctorList'].length != 0) { - doctorsList.clear(); - res['DoctorList'].forEach((v) { - doctorsList.add(new DoctorList.fromJson(v)); - }); - doctorsList.forEach((element) { - List doctorByHospital = _patientDoctorAppointmentListHospital - .where( - (elementClinic) => elementClinic.filterName == element.getProjectCompleteName(), - ) - .toList(); - - if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); - } else { - _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList( - filterName: element.getProjectCompleteName(), - distanceInKMs: element.projectDistanceInKiloMeters.toString(), - projectTopName: element.projectTopName ?? "", - projectBottomName: element.projectBottomName ?? "", - patientDoctorAppointment: element)); - } - }); - } else {} - }); + if (res['DoctorList'].length != 0) { + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson( + v, + )); + }); + + regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); + regionHospitalList = + await DoctorMapper.sortList(true, regionHospitalList); + + setState(() {}); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: res['ErrorSearchMsg']); + } - result = LinkedHashSet.from(arr).toList(); - numAll = result.length; - nearestAppo = false; - isProjectLoaded = false; - navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + GifLoaderDialogUtils.hideDialog(context); + // navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + navigateToSearchResults(context, regionHospitalList); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { @@ -709,16 +706,18 @@ class _SearchByClinicState extends State { }); } - Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - isProjectLoaded = false; - Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, isDoctorSearchResult: true,))) - .then((value) { - setState(() { - dropdownValue = "null"; - dropdownTitle = ""; - }); - getProjectsList(); - }); + navigateToSearchResults(context, RegionList regionHospitalList) { + // Navigator.push(context, + // FadePage(page: SearchResults(isLiveCareAppointment: false, isDoctorNameSearch: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, isDoctorSearchResult: true,))); + Navigator.push( + context, + FadePage( + page: SearchResultsByRegion( + doctorsList: [], + patientDoctorAppointmentListHospital: regionHospitalList, + isLiveCareAppointment: false, + isDoctorSearchResult: true, + ))); } filterClinic() { diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 4ff9f1af..4ce443c4 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResultsByRegion.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/services/appointment_services/mock_doctor_response.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -13,7 +12,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../services/appointment_services/doctor_response_mapper.dart'; -import '../SearchResults.dart'; class SearchByDoctor extends StatefulWidget { @override @@ -112,13 +110,14 @@ class _SearchByDoctorState extends State { if (res['DoctorList'].length != 0) { res['DoctorList'].forEach((v) { - var reg = region[counter % 4]; - counter++; - doctorsList - .add(new DoctorList.fromJson(v, region: reg, isHMC: isHmc)); - isHmc = !isHmc; + // var reg = region[counter % 4]; + // counter++; + doctorsList.add(new DoctorList.fromJson( + v, + )); + // isHmc = !isHmc; }); - print('the counter is ${counter}'); + // print('the counter is ${counter}'); regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); regionHospitalList = diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index 34b82512..c03e8c4d 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -1,14 +1,13 @@ -import 'dart:collection'; - import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResultsByRegion.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/LaserClinic.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/doctor_response_mapper.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../config/shared_pref_kay.dart'; import '../../../config/size_config.dart'; import '../../../core/model/hospitals/hospitals_model.dart'; import '../../../core/viewModels/project_view_model.dart'; @@ -16,7 +15,6 @@ import '../../../models/Appointments/DoctorListResponse.dart'; import '../../../models/Appointments/SearchInfoModel.dart'; import '../../../models/Clinics/ClinicListResponse.dart'; import '../../../services/appointment_services/GetDoctorsList.dart'; -import '../../../services/authentication/auth_provider.dart'; import '../../../services/clinic_services/get_clinic_service.dart'; import '../../../uitl/app_toast.dart'; import '../../../uitl/gif_loader_dialog_utils.dart'; @@ -24,8 +22,6 @@ import '../../../uitl/translations_delegate_base.dart'; import '../../../widgets/transitions/fade_page.dart'; import '../../livecare/livecare_home.dart'; import '../DentalComplaints.dart'; -import '../LaserBooking.dart'; -import '../SearchResults.dart'; import '../dialog/clinic_list_dialog.dart'; import 'LiveCareBookAppointment.dart'; @@ -386,36 +382,42 @@ class _SearchByHospitalState extends State { List _patientDoctorAppointmentListHospital = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(clinicID, selectedHospital?.mainProjectID.toString() != "" ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") : 0, nearestAppo, languageID, null).then((res) { + service + .getDoctorsList( + clinicID, + selectedHospital?.mainProjectID.toString() != "" + ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") + : 0, + nearestAppo, + languageID, + null) + .then((res) async { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - setState(() { - if (res['DoctorList'].length != 0) { - doctorsList.clear(); - res['DoctorList'].forEach((v) { - doctorsList.add(DoctorList.fromJson(v)); - }); - doctorsList.forEach((element) { - List doctorByHospital = _patientDoctorAppointmentListHospital - .where( - (elementClinic) => elementClinic.filterName == element.getProjectCompleteName(), - ) - .toList(); - - if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); - } else { - _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); - } - }); - } else {} - }); + RegionList regionHospitalList = RegionList(); + + if (res['DoctorList'].length != 0) { + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson( + v, + )); + }); + + regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); + regionHospitalList = + await DoctorMapper.sortList(true, regionHospitalList); + + setState(() {}); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: res['ErrorSearchMsg']); + } - result = LinkedHashSet.from(arr).toList(); - numAll = result.length; - navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + GifLoaderDialogUtils.hideDialog(context); + // navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + navigateToSearchResults(context, regionHospitalList); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { @@ -425,18 +427,20 @@ class _SearchByHospitalState extends State { }); } - Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, - FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, isDoctorSearchResult: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) - .then((value) { - print("navigation return "); - dropdownValue = null; - dropdownTitle = ""; - selectedHospital = null; - clinicIds = List.empty(); - setState(() {}); - // getProjectsList(); - }); + navigateToSearchResults(context, RegionList regionHospitalList) { + // Navigator.push(context, + // FadePage(page: SearchResults(isLiveCareAppointment: false, isDoctorNameSearch: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, isDoctorSearchResult: true,))); + Navigator.push( + context, + FadePage( + page: SearchResultsByRegion( + doctorsList: [], + patientDoctorAppointmentListHospital: regionHospitalList, + isLiveCareAppointment: false, + isDoctorSearchResult: true, + ), + ), + ); } Future navigateToLaserClinic(BuildContext context) async { diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 29760390..ac6e4230 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -79,7 +79,7 @@ class _DoctorViewState extends State with AutomaticKeepAliveClientMi BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, - blurRadius: 27, + blurRadius: 5, offset: Offset(0, -3), ), ], diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index b62fc1f1..c5dfa225 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1,9 +1,9 @@ import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; @@ -11,9 +11,7 @@ import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.d import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; -import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; -import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -135,13 +133,12 @@ class DoctorsListService extends BaseService { dynamic localRes = response; - - - // await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { - // localRes = response; - // }, onFailure: (String error, int statusCode) { - // throw error; - // }, body: request); + await baseAppClient.post(GET_DOCTORS_LIST_URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index 0cdef6ca..aba01f85 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -1,8 +1,6 @@ import 'dart:math'; import 'dart:typed_data'; -import 'dart:ui'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -31,7 +29,7 @@ class LocalNotification { _initialize() async { try { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); + var initializationSettingsIOS = DarwinInitializationSettings(); var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); await flutterLocalNotificationsPlugin.initialize( initializationSettings, diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 2054f969..f35dadba 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -21,6 +21,8 @@ class AppExpandableNotifier extends StatefulWidget { bool hasCounter = false; String counter = "0"; Color widgetColor; + Color? headerColor; + Color? completeHeaderColor; var controller = new ExpandableController(); bool isTitleSingleLine; bool isDisabled = false; @@ -28,6 +30,10 @@ class AppExpandableNotifier extends StatefulWidget { final String? projectTitleTop; final String? projectTitleBottom; final bool showDropDownIconWithCustomHeader; + final BorderRadius? headerRadius; + final bool applyBackgroundColor; + final bool applyBackgroundToOnlyHeader; + final double? paddingValue; AppExpandableNotifier( {this.headerWidget, @@ -39,12 +45,17 @@ class AppExpandableNotifier extends StatefulWidget { this.hasCounter = false, this.counter = "0", this.widgetColor = Colors.white, + this.headerColor, + this.completeHeaderColor, this.isDisabled = false, this.isDoctorSearchResult = false, this.projectTitleTop = "", this.projectTitleBottom = "", this.showDropDownIconWithCustomHeader = false, - }); + this.headerRadius, + this.applyBackgroundColor = true, + this.applyBackgroundToOnlyHeader = false, + this.paddingValue}); _AppExpandableNotifier createState() => _AppExpandableNotifier(); } @@ -86,7 +97,9 @@ class _AppExpandableNotifier extends State { return ExpandableNotifier( child: Container( - color: widget.widgetColor != null ? widget.widgetColor : Colors.white, + decoration: BoxDecoration( + color: (widget.applyBackgroundColor) ? widget.widgetColor : null, + ), child: Column( children: [ if(widget.showDropDownIconWithCustomHeader == false && widget.headerWidget != null) @@ -103,27 +116,32 @@ class _AppExpandableNotifier extends State { headerAlignment: ExpandablePanelHeaderAlignment.center, tapBodyToCollapse: true, ), - header: Padding( - padding: const EdgeInsets.only(top: 20, bottom: 20, left: 21, right: 21), - child: InkWell( - onTap: () { - if (!widget.isDisabled) - setState(() { - widget.expandFlag = !widget.expandFlag; - widget.controller.expanded = widget.expandFlag; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if(widget.showDropDownIconWithCustomHeader && widget.headerWidget != null) - ...{ + header: Material( + color: widget.applyBackgroundToOnlyHeader + ? widget.headerColor + : Colors.transparent, + shape: RoundedRectangleBorder( + borderRadius: widget.headerRadius ?? BorderRadius.zero), + child: Padding( + padding: EdgeInsets.all(widget.paddingValue ?? 20), + child: InkWell( + onTap: () { + if (!widget.isDisabled) + setState(() { + widget.expandFlag = !widget.expandFlag; + widget.controller.expanded = widget.expandFlag; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (widget.showDropDownIconWithCustomHeader && + widget.headerWidget != null) ...{ Expanded( child: SizedBox( - child: widget.headerWidget, - ))} - else - ...{ + child: widget.headerWidget, + )) + } else ...{ //todo use the custom header to show the drop down Expanded( child: Column( @@ -134,46 +152,51 @@ class _AppExpandableNotifier extends State { widget.isTitleSingleLine) !widget.hasCounter ? Text( - _mainTitle, - style: TextStyle(fontSize: 20, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.72, - height: 1), - ) - : Row( - children: [ - Text( - _mainTitle, - style: TextStyle(fontSize: 20, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.72, - height: 1), - ), - SizedBox( - width: 10.0, - ), - CircleAvatar( - backgroundColor: CustomColors - .accentColor, - radius: 12.0, - child: Text( - widget.counter, - style: TextStyle(fontSize: 14, + _mainTitle, + style: TextStyle( + fontSize: 20, fontWeight: FontWeight.w600, - color: Colors.white, - letterSpacing: -0.72), + color: Color(0xff2E303A), + letterSpacing: -0.72, + height: 1), + ) + : Row( + children: [ + Text( + _mainTitle, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.72, + height: 1), + ), + SizedBox( + width: 10.0, + ), + CircleAvatar( + backgroundColor: + CustomColors.accentColor, + radius: 12.0, + child: Text( + widget.counter, + style: TextStyle( + fontSize: 14, + fontWeight: + FontWeight.w600, + color: Colors.white, + letterSpacing: -0.72), + ), + ) + ], ), - ) - ], - ), if (_title.isNotEmpty && !widget.isTitleSingleLine) Text( _title, maxLines: 1, - style: TextStyle(fontSize: 24, + style: TextStyle( + fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2E303A), letterSpacing: -1.44, @@ -184,7 +207,8 @@ class _AppExpandableNotifier extends State { Text( _subTitle, maxLines: 1, - style: TextStyle(fontSize: 14, + style: TextStyle( + fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, @@ -192,13 +216,17 @@ class _AppExpandableNotifier extends State { ), ], ), - ),} - ,Icon( - widget.expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, - color: Color(0xff2E303A), - // size: 30.0, - ), - ], + ), + }, + Icon( + widget.expandFlag + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Color(0xff2E303A), + // size: 30.0, + ), + ], + ), ), ), ),