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.
diplomatic-quarter/lib/pages/BookAppointment/search_result/ResultByDoctors.dart

131 lines
4.7 KiB
Dart

import 'package:auto_size_text/auto_size_text.dart';
import 'package:diplomaticquarterapp/config/size_config.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/widgets/DoctorView.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ResultByDoctor extends StatefulWidget {
List<DoctorList> doctorsList = [];
List<DoctorList>? patientDoctorAppointmentListHospital;
final bool isLiveCareAppointment;
final bool isObGyneAppointment;
final bool isDoctorNameSearch;
final bool isDoctorSearchResult;
final bool showNearestAppointment;
final bool nearestAppointmentDoctors;
final OBGyneProcedureListResponse? obGyneProcedureListResponse;
final Function(bool)? refreshDoctorList;
ResultByDoctor({
required this.doctorsList,
required this.patientDoctorAppointmentListHospital,
required this.isLiveCareAppointment,
required this.isObGyneAppointment,
required this.isDoctorNameSearch,
required this.isDoctorSearchResult,
this.showNearestAppointment = false,
this.nearestAppointmentDoctors = false,
this.obGyneProcedureListResponse,
this.refreshDoctorList
});
@override
State<ResultByDoctor> createState() => _ResultByDoctorState();
}
class _ResultByDoctorState extends State<ResultByDoctor> {
bool nearestAppo = false;
@override
void initState() {
nearestAppo = widget.nearestAppointmentDoctors;
super.initState();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Visibility(
visible: widget.showNearestAppointment,
child: Padding(
padding: const EdgeInsets.only(left: 6, right: 6,),
child: Row(
children: <Widget>[
Checkbox(
activeColor: CustomColors.accentColor,
value: nearestAppo,
onChanged: (bool? value) {
setState(() {
nearestAppo = value ?? false;
});
widget.refreshDoctorList?.call(nearestAppo);
},
),
AutoSizeText(
TranslationBase.of(context).nearestAppo.trim(),
maxLines: 1,
minFontSize: 10,
style: TextStyle(
fontSize: SizeConfig.textMultiplier! * 1.4,
fontWeight: FontWeight.w600,
letterSpacing: -0.39,
height: 0.8,
),
),
// Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)),
],
),
),
),
widget.patientDoctorAppointmentListHospital?.isNotEmpty == true
? Expanded(
child: ListView.separated(
addAutomaticKeepAlives: true,
physics: BouncingScrollPhysics(),
separatorBuilder: (context, index) {
return Material(
color: Color(0xFFf5f5f5),
child: SizedBox(
height: 12,
),
);
},
itemBuilder: (context, index) {
final doctor = widget.patientDoctorAppointmentListHospital![index];
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: DoctorView(
doctor: doctor,
isLiveCareAppointment: widget.isLiveCareAppointment,
isObGyneAppointment: widget.isObGyneAppointment,
isDoctorNameSearch: widget.isDoctorNameSearch,
obGyneProcedureListResponse: widget.obGyneProcedureListResponse,
isShowDate: false,
onTap: () {
context.read<ProjectViewModel>().analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor);
}),
);
},
itemCount: widget.patientDoctorAppointmentListHospital?.length ?? 0,
),
)
: getNoDataWidget(context),
],
);
}
@override
void dispose() {
super.dispose();
}
}