You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
854 lines
35 KiB
Dart
854 lines
35 KiB
Dart
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
|
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/search_result/ResultByClinic.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByDoctors.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByFacility.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByHospital.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByRegion.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/doctor_response_mapper.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../config/shared_pref_kay.dart';
|
|
import '../../../core/service/client/base_app_client.dart';
|
|
|
|
class SearchResultWithTabForHospital extends StatefulWidget {
|
|
List<DoctorList> doctorsList = [];
|
|
RegionList patientDoctorAppointmentListHospital;
|
|
bool isLiveCareAppointment;
|
|
bool isObGyneAppointment;
|
|
bool isDoctorNameSearch;
|
|
OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
|
bool isDoctorSearchResult;
|
|
|
|
bool isForHospital;
|
|
|
|
SearchResultWithTabForHospital({
|
|
required this.doctorsList,
|
|
required this.patientDoctorAppointmentListHospital,
|
|
this.isObGyneAppointment = false,
|
|
this.isDoctorNameSearch = false,
|
|
required this.isLiveCareAppointment,
|
|
required this.isDoctorSearchResult,
|
|
this.obGyneProcedureListResponse,
|
|
this.isForHospital = true,
|
|
});
|
|
|
|
@override
|
|
State<SearchResultWithTabForHospital> createState() =>
|
|
_SearchResultWithTabForHospitalState();
|
|
}
|
|
|
|
class _SearchResultWithTabForHospitalState
|
|
extends State<SearchResultWithTabForHospital> {
|
|
int _currentIndex = 0;
|
|
late PageController _controller;
|
|
String selectedRegion = "";
|
|
HospitalsModel? selectedHospital;
|
|
bool isHMCSelected = false;
|
|
int selectedHospitalIndex = -1;
|
|
ScrollController scrollController = ScrollController();
|
|
RegionList? doctorList;
|
|
bool nearestAppointment= false;
|
|
int clinicId = -1;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = new PageController();
|
|
}
|
|
|
|
changePageViewIndex(pageIndex) {
|
|
_controller.jumpToPage(pageIndex);
|
|
// if (scrollController.hasClients) {
|
|
// print("it has clients");
|
|
// scrollController.animateTo(pageIndex.toDouble(),curve: Curves.easeOut,
|
|
// duration: const Duration(milliseconds: 300),);}
|
|
}
|
|
|
|
void handleBackClick() {
|
|
switch (_currentIndex) {
|
|
case 1:
|
|
selectedHospitalIndex = -1;
|
|
selectedRegion = "";
|
|
doctorList = null;
|
|
_currentIndex = 0;
|
|
changePageViewIndex(0);
|
|
break;
|
|
case 2:
|
|
selectedHospitalIndex = -1;
|
|
doctorList = null;
|
|
_currentIndex = 1;
|
|
changePageViewIndex(1);
|
|
break;
|
|
case 3:
|
|
selectedHospitalIndex = -1;
|
|
doctorList = null;
|
|
_currentIndex = 2;
|
|
changePageViewIndex(2);
|
|
break;
|
|
case 4:
|
|
_currentIndex = 3;
|
|
doctorList = null;
|
|
changePageViewIndex(3);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
child: widget.patientDoctorAppointmentListHospital.registeredDoctorMap
|
|
?.isNotEmpty ==
|
|
true
|
|
? SizedBox(
|
|
height: SizeConfig.realScreenHeight! * .9,
|
|
width: SizeConfig.realScreenWidth,
|
|
child: Column(children: <Widget>[
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(left: 20, right: 20, top: 12),
|
|
child: SizedBox(
|
|
height: 100,
|
|
child: ListView(
|
|
scrollDirection: Axis.horizontal,
|
|
controller: scrollController,
|
|
children: [
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width / 5.2,
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).selectRegion,
|
|
status: _currentIndex == 0
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 0
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 0
|
|
? CustomColors.orange
|
|
: CustomColors.green,
|
|
onTap: () {
|
|
setState(() {
|
|
selectedHospitalIndex = -1;
|
|
selectedRegion = "";
|
|
doctorList = null;
|
|
_currentIndex = 0;
|
|
changePageViewIndex(0);
|
|
nearestAppointment = false;
|
|
clinicId = -1;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width / 5.2,
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).selectFacitlity,
|
|
status: _currentIndex == 1
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 1
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 1
|
|
? CustomColors.orange
|
|
: _currentIndex > 1
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
onTap: () {
|
|
setState(() {
|
|
selectedHospitalIndex = -1;
|
|
doctorList = null;
|
|
_currentIndex = 1;
|
|
changePageViewIndex(1);
|
|
nearestAppointment = false;
|
|
clinicId = -1;
|
|
|
|
});
|
|
},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width / 5.2,
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).selectBranch,
|
|
status: _currentIndex == 2
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 1
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 2
|
|
? CustomColors.orange
|
|
: _currentIndex > 2
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
onTap: () {
|
|
setState(() {
|
|
selectedHospitalIndex = -1;
|
|
doctorList = null;
|
|
_currentIndex = 2;
|
|
changePageViewIndex(2);
|
|
nearestAppointment = false;
|
|
clinicId = -1;
|
|
|
|
});
|
|
},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width / 5.2,
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).selectClinic,
|
|
status: _currentIndex == 3
|
|
? TranslationBase.of(context).inPrgress
|
|
: _currentIndex > 3
|
|
? TranslationBase.of(context).completed
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex == 3
|
|
? CustomColors.orange
|
|
: _currentIndex > 3
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
onTap: () {
|
|
setState(() {
|
|
doctorList = null;
|
|
changePageViewIndex(3);
|
|
_currentIndex = 3;
|
|
nearestAppointment= false;
|
|
clinicId = -1;
|
|
|
|
});
|
|
},
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width / 5.2,
|
|
child: showProgress(
|
|
title: TranslationBase.of(context).selectDoctor,
|
|
status: _currentIndex ==
|
|
((widget.isForHospital) ? 4 : 3)
|
|
? TranslationBase.of(context).inPrgress
|
|
: TranslationBase.of(context).locked,
|
|
color: _currentIndex ==
|
|
((widget.isForHospital) ? 4 : 3)
|
|
? CustomColors.orange
|
|
: _currentIndex ==
|
|
((widget.isForHospital) ? 5 : 4)
|
|
? CustomColors.green
|
|
: CustomColors.grey2,
|
|
isNeedBorder: false,
|
|
onTap: () {
|
|
setState(() {
|
|
_currentIndex =
|
|
((widget.isForHospital) ? 4 : 3);
|
|
changePageViewIndex(_currentIndex);
|
|
});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(10.0, 18, 0, 24),
|
|
child: Row(
|
|
children: [
|
|
(_currentIndex != 0)
|
|
? InkWell(
|
|
onTap: () {
|
|
handleBackClick();
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
0, 0, 04, 0),
|
|
child: Icon(
|
|
Icons.arrow_back,
|
|
color: Theme.of(context).primaryColor,
|
|
),
|
|
),
|
|
)
|
|
: mWidth(24),
|
|
Text(
|
|
getTitle(),
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
// mHeight(24),
|
|
Expanded(
|
|
child: PageView(
|
|
physics: NeverScrollableScrollPhysics(),
|
|
controller: _controller,
|
|
onPageChanged: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
scrollDirection: Axis.horizontal,
|
|
children: <Widget>[
|
|
ResultByRegion(
|
|
doctorsList: widget.doctorsList,
|
|
patientDoctorAppointmentListHospital:
|
|
widget.patientDoctorAppointmentListHospital,
|
|
onRegionSelected: (key) {
|
|
setState(() {
|
|
selectedRegion = key;
|
|
_currentIndex = 1;
|
|
changePageViewIndex(1);
|
|
});
|
|
}),
|
|
(selectedRegion != "")
|
|
? ResultByFacility(
|
|
doctorsList: widget.doctorsList,
|
|
patientDoctorAppointmentListHospital:
|
|
widget.patientDoctorAppointmentListHospital,
|
|
selectedRegion: selectedRegion,
|
|
onFacilitySelected: (isHMCSelected) {
|
|
setState(() {
|
|
this.isHMCSelected = isHMCSelected;
|
|
_currentIndex = 2;
|
|
changePageViewIndex(2);
|
|
});
|
|
},
|
|
)
|
|
: SizedBox.shrink(),
|
|
(selectedRegion != '')
|
|
? ResultByHospital(
|
|
doctorsList: widget.doctorsList,
|
|
paitientDoctorAppointmentList: (isHMCSelected)
|
|
? widget
|
|
.patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap![selectedRegion]!
|
|
.hmcDoctorList ??
|
|
[]
|
|
: widget
|
|
.patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[selectedRegion]
|
|
?.hmgDoctorList ??
|
|
[],
|
|
isHMCSelected: isHMCSelected,
|
|
isLiveCareAppointment:
|
|
widget.isLiveCareAppointment,
|
|
isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
onHospitalSelected: (hospitalName, index) {
|
|
setState(() {
|
|
selectedHospitalIndex = index;
|
|
selectedHospital = (!isHMCSelected)
|
|
? widget
|
|
.patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap![selectedRegion]!
|
|
.hmgDoctorList![selectedHospitalIndex]
|
|
.hospitalList
|
|
.first
|
|
: widget
|
|
.patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap![selectedRegion]!
|
|
.hmcDoctorList![selectedHospitalIndex]
|
|
.hospitalList
|
|
.first;
|
|
_currentIndex = 3;
|
|
changePageViewIndex(3);
|
|
});
|
|
})
|
|
: SizedBox.shrink(),
|
|
(selectedHospital != null &&
|
|
selectedRegion != '' &&
|
|
selectedHospitalIndex != -1)
|
|
? ResultByClinic(
|
|
onClinicSelected: (doctorList, clinicId) {
|
|
setState(() {
|
|
this.nearestAppointment = false;
|
|
this.doctorList = doctorList;
|
|
_currentIndex = 4;
|
|
changePageViewIndex(4);
|
|
if(clinicId != null)
|
|
this.clinicId = clinicId;
|
|
});
|
|
},
|
|
selectedValue: selectedHospital)
|
|
: SizedBox.shrink(),
|
|
(selectedRegion != '' &&
|
|
selectedHospitalIndex != -1 &&
|
|
doctorList != null)
|
|
? ResultByDoctor(
|
|
doctorsList: widget.doctorsList,
|
|
patientDoctorAppointmentListHospital:
|
|
(!isHMCSelected)
|
|
? doctorList!
|
|
.registeredDoctorMap![
|
|
selectedRegion]!
|
|
.hmgDoctorList!
|
|
.first
|
|
.patientDoctorAppointmentList ??
|
|
[]
|
|
: doctorList!
|
|
.registeredDoctorMap?[
|
|
selectedRegion]
|
|
?.hmcDoctorList!
|
|
.first
|
|
.patientDoctorAppointmentList ??
|
|
[],
|
|
isLiveCareAppointment:
|
|
widget.isLiveCareAppointment,
|
|
isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
isObGyneAppointment: widget.isObGyneAppointment,
|
|
isDoctorNameSearch: widget.isDoctorNameSearch,
|
|
showNearestAppointment: clinicId != -1 ,
|
|
nearestAppointmentDoctors: nearestAppointment,
|
|
refreshDoctorList: (isNearestAppointmentChecked){
|
|
setState(() {
|
|
// changePageViewIndex(3);
|
|
// _currentIndex = 3;
|
|
nearestAppointment= false;
|
|
});
|
|
callDoctorsSearchAPI(clinicId, isNearestAppointmentChecked);
|
|
},
|
|
|
|
)
|
|
: SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
]),
|
|
)
|
|
: getNoDataWidget(context),
|
|
);
|
|
}
|
|
|
|
callDoctorsSearchAPI(int clinicID, bool nearestAppointment) {
|
|
var isArabic = context.read<ProjectViewModel>().isArabic;
|
|
int languageID = isArabic ? 1 : 2;
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
List<DoctorList> doctorsList = [];
|
|
List<String> arr = [];
|
|
List<String> arrDistance = [];
|
|
List<String> result;
|
|
int numAll;
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = [];
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
service
|
|
.getDoctorsList(clinicID, selectedHospital?.mainProjectID.toString() != "" ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") : 0, nearestAppointment, languageID, null)
|
|
.then((res) async {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['MessageStatus'] == 1) {
|
|
RegionList regionHospitalList = RegionList();
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
res['DoctorList'].forEach((v) {
|
|
doctorsList.add(new DoctorList.fromJson(
|
|
v,
|
|
));
|
|
});
|
|
|
|
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList, isArabic: isArabic);
|
|
var lat = await sharedPref.getDouble(USER_LAT);
|
|
|
|
var lng = await sharedPref.getDouble(USER_LONG);
|
|
var isLocationEnabled = (lat != null && lat != 0.0) && (lng != null && lng != 0.0);
|
|
regionHospitalList = await DoctorMapper.sortList(isLocationEnabled, regionHospitalList);
|
|
|
|
setState(() {
|
|
this.doctorList = regionHospitalList;
|
|
_currentIndex = 4;
|
|
changePageViewIndex(4);
|
|
this.nearestAppointment = nearestAppointment;
|
|
});
|
|
} else {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: res['ErrorSearchMsg']);
|
|
}
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
// navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
} else {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
AppToast.showErrorToast(message: err, localContext: context);
|
|
});
|
|
}
|
|
String getTitle() {
|
|
switch (_currentIndex) {
|
|
case 0:
|
|
return TranslationBase.of(context).selectRegion;
|
|
case 1:
|
|
return TranslationBase.of(context).selectFacitlity;
|
|
case 2:
|
|
return TranslationBase.of(context).selectBranch;
|
|
case 3:
|
|
return TranslationBase.of(context).selectClinic;
|
|
case 4:
|
|
return TranslationBase.of(context).selectDoctor;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
Widget showProgress(
|
|
{String? title,
|
|
String? status,
|
|
Color? color,
|
|
bool isNeedBorder = true,
|
|
Function()? onTap}) {
|
|
return InkWell(
|
|
onTap: () {
|
|
if (status == TranslationBase.of(context).completed) {
|
|
onTap?.call();
|
|
}
|
|
},
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 26,
|
|
height: 26,
|
|
decoration: containerRadius(color!, 200),
|
|
child: Icon(
|
|
Icons.done,
|
|
color: Colors.white,
|
|
size: 16,
|
|
),
|
|
),
|
|
if (isNeedBorder)
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: mDivider(Colors.grey),
|
|
)),
|
|
],
|
|
),
|
|
mHeight(8),
|
|
Text(
|
|
title!,
|
|
style: TextStyle(
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.w500,
|
|
letterSpacing: -0.44,
|
|
),
|
|
),
|
|
mHeight(2),
|
|
Container(
|
|
padding: EdgeInsets.all(5),
|
|
decoration: containerRadius(color!.withOpacity(0.2), 4),
|
|
child: Text(
|
|
status!,
|
|
style: TextStyle(
|
|
fontSize: 8,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.32,
|
|
color: color,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HospitalBodyWidget extends StatelessWidget {
|
|
final List<PatientDoctorAppointmentList>?
|
|
patientDoctorAppointmentListHospital;
|
|
final bool isLiveCareAppointment;
|
|
final bool isObGyneAppointment;
|
|
final bool isDoctorNameSearch;
|
|
final bool isDoctorSearchResult;
|
|
final OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
|
|
|
const HospitalBodyWidget({
|
|
super.key,
|
|
this.patientDoctorAppointmentListHospital,
|
|
required this.isLiveCareAppointment,
|
|
required this.isObGyneAppointment,
|
|
required this.isDoctorNameSearch,
|
|
required this.isDoctorSearchResult,
|
|
this.obGyneProcedureListResponse,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.separated(
|
|
addAutomaticKeepAlives: true,
|
|
shrinkWrap: true,
|
|
physics: NeverScrollableScrollPhysics(),
|
|
itemCount: patientDoctorAppointmentListHospital?.length ?? 0,
|
|
separatorBuilder: (context, index) {
|
|
return Container(
|
|
height: 12,
|
|
margin: EdgeInsets.only(left: 21, right: 21),
|
|
);
|
|
},
|
|
itemBuilder: (context, index) {
|
|
return AppExpandableNotifier(
|
|
applyBackgroundColor: false,
|
|
widgetColor: CustomColors.appBackgroudGrey2Color,
|
|
title: (patientDoctorAppointmentListHospital?[index].distanceInKMs !=
|
|
"0")
|
|
? patientDoctorAppointmentListHospital![index].filterName! +
|
|
" - " +
|
|
patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
|
" " +
|
|
TranslationBase.of(context).km
|
|
: patientDoctorAppointmentListHospital![index].filterName,
|
|
projectTitleTop:
|
|
patientDoctorAppointmentListHospital![index].projectTopName,
|
|
projectTitleBottom: (patientDoctorAppointmentListHospital![index]
|
|
.distanceInKMs !=
|
|
"0")
|
|
? patientDoctorAppointmentListHospital![index]
|
|
.projectBottomName
|
|
.toString() +
|
|
" - " +
|
|
patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
|
" " +
|
|
TranslationBase.of(context).km
|
|
: patientDoctorAppointmentListHospital![index]
|
|
.projectBottomName
|
|
.toString(),
|
|
isTitleSingleLine: false,
|
|
isDoctorSearchResult: isDoctorSearchResult,
|
|
isExpand:
|
|
patientDoctorAppointmentListHospital?.length == 1 ? true : false,
|
|
bodyWidget: ListView.separated(
|
|
shrinkWrap: true,
|
|
physics: NeverScrollableScrollPhysics(),
|
|
padding:
|
|
EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21),
|
|
itemBuilder: (context, _index) {
|
|
// print("the index of patientDoctorAppointmentList is ${_index}");
|
|
// print("the index of parent is ${index}");
|
|
final doctor = patientDoctorAppointmentListHospital![index]
|
|
.patientDoctorAppointmentList![_index];
|
|
// print('the doctor is ${doctor.toJson()}');
|
|
return DoctorView(
|
|
doctor: doctor,
|
|
isLiveCareAppointment: isLiveCareAppointment,
|
|
isObGyneAppointment: isObGyneAppointment,
|
|
isDoctorNameSearch: isDoctorNameSearch,
|
|
obGyneProcedureListResponse: obGyneProcedureListResponse,
|
|
isShowDate: false,
|
|
onTap: () {
|
|
context
|
|
.read<ProjectViewModel>()
|
|
.analytics
|
|
.appointment
|
|
.book_appointment_select_doctor(
|
|
appointment_type: 'regular', doctor: doctor);
|
|
});
|
|
},
|
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
itemCount: patientDoctorAppointmentListHospital?[index]
|
|
.patientDoctorAppointmentList
|
|
?.length ??
|
|
0),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class RegionTitle extends StatelessWidget {
|
|
final String title;
|
|
final String hmcCount;
|
|
final String hmgCount;
|
|
|
|
const RegionTitle(
|
|
{super.key,
|
|
required this.title,
|
|
required this.hmcCount,
|
|
required this.hmgCount});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 22, color: Colors.black, fontWeight: FontWeight.w700),
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"${TranslationBase.of(context).HospitalString(num.parse(hmgCount)).replaceAll("@", hmgCount)} ,",
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Color(0xFFD02127),
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
Text(
|
|
"${TranslationBase.of(context).MedicalCenterString(num.parse(hmcCount)).replaceAll("@", hmcCount)}",
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Color(0xFF40ACC9),
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HospitalTitle extends StatelessWidget {
|
|
final String title;
|
|
final String iconUrl;
|
|
final bool isHMC;
|
|
final String itemCount;
|
|
|
|
const HospitalTitle(
|
|
{super.key,
|
|
required this.title,
|
|
required this.iconUrl,
|
|
required this.isHMC,
|
|
required this.itemCount});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SvgPicture.asset(iconUrl),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
color: isHMC ? Color(0xFF40ACC9) : Color(0xFFD02127),
|
|
fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
Text(
|
|
isHMC
|
|
? "${TranslationBase.of(context).MedicalCenterString(num.parse(itemCount)).replaceAll("@", itemCount)}"
|
|
: "${TranslationBase.of(context).HospitalString(num.parse(itemCount)).replaceAll("@", itemCount)}",
|
|
style: TextStyle(
|
|
fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
///todo the current content of the application
|
|
/// return AppExpandableNotifier(
|
|
// paddingValue: 10,
|
|
// applyBackgroundToOnlyHeader: true,
|
|
// completeHeaderColor: CustomColors.appBackgroudGrey2Color,
|
|
// headerWidget: RegionTitle(
|
|
// title: key,
|
|
// hmcCount:
|
|
// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
|
|
// hmgCount:
|
|
// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
|
|
// ),
|
|
// showDropDownIconWithCustomHeader: true,
|
|
// isTitleSingleLine: false,
|
|
// isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
// widgetColor: Color(0xFFF8F8F8),
|
|
// bodyWidget: Column(
|
|
// children: [
|
|
// 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:
|
|
// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
|
|
// ),
|
|
// showDropDownIconWithCustomHeader: true,
|
|
// bodyWidget: HospitalBodyWidget(
|
|
// patientDoctorAppointmentListHospital:
|
|
// widget.patientDoctorAppointmentListHospital
|
|
// .registeredDoctorMap?[key]?.hmgDoctorList,
|
|
// isLiveCareAppointment: widget.isLiveCareAppointment,
|
|
// isObGyneAppointment: widget.isObGyneAppointment,
|
|
// isDoctorNameSearch: widget.isDoctorNameSearch,
|
|
// isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// 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:
|
|
// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
|
|
// ),
|
|
// showDropDownIconWithCustomHeader: true,
|
|
// bodyWidget: HospitalBodyWidget(
|
|
// patientDoctorAppointmentListHospital:
|
|
// widget.patientDoctorAppointmentListHospital
|
|
// .registeredDoctorMap?[key]?.hmcDoctorList,
|
|
// isLiveCareAppointment: widget.isLiveCareAppointment,
|
|
// isObGyneAppointment: widget.isObGyneAppointment,
|
|
// isDoctorNameSearch: widget.isDoctorNameSearch,
|
|
// isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ));
|