shcedule page

merge-update-with-lab-changes
Sultan Khan 4 years ago
parent abcd207554
commit 233a273316

@ -44,7 +44,7 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
TabController _tabController; TabController _tabController;
bool showFooterButton = false; bool showFooterButton = false;
var event = RobotProvider(); var event = RobotProvider();
dynamic doctorSchedule;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
List<DoctorRateDetails> doctorDetailsList = List(); List<DoctorRateDetails> doctorDetailsList = List();
@ -122,7 +122,11 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
FadePage( FadePage(
page: SchedulePage(doctorList: widget.doctor), page: SchedulePage(doctorList: widget.doctor),
), ),
); ).then((value) {
setState(() {
this.doctorSchedule = value;
});
});
}, },
onRatingAndReviewTap: () { onRatingAndReviewTap: () {
getDoctorRatingsDetails(); getDoctorRatingsDetails();
@ -170,7 +174,11 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: [ children: [
DoctorInformation(docProfileList: widget.docProfileList), DoctorInformation(docProfileList: widget.docProfileList),
DocAvailableAppointments(doctor: widget.doctor, isLiveCareAppointment: widget.isLiveCareAppointment), DocAvailableAppointments(
doctor: widget.doctor,
isLiveCareAppointment: widget.isLiveCareAppointment,
doctorSchedule: doctorSchedule,
),
], ],
controller: _tabController, controller: _tabController,
), ),

@ -24,10 +24,7 @@ class DocAvailableAppointments extends StatefulWidget {
static String selectedTime; static String selectedTime;
bool isLiveCareAppointment; bool isLiveCareAppointment;
final dynamic doctorSchedule; final dynamic doctorSchedule;
DocAvailableAppointments( DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment});
{@required this.doctor,
this.doctorSchedule,
@required this.isLiveCareAppointment});
@override @override
_DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState(); _DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState();
@ -55,6 +52,15 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
var language; var language;
@override
void didUpdateWidget(covariant DocAvailableAppointments oldWidget) {
if (oldWidget.doctorSchedule != widget.doctorSchedule) {
_calendarController.setSelectedDay(DateUtil.convertStringToDate(widget.doctorSchedule['Date']), isProgrammatic: true);
_onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date']), List());
}
super.didUpdateWidget(oldWidget);
}
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -121,7 +127,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
children: <Widget>[ children: <Widget>[
_buildTableCalendarWithBuilders(), _buildTableCalendarWithBuilders(),
Padding( Padding(
padding: const EdgeInsets.only(left: 16,right: 16,bottom: 16), padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Text(selectedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), child: Text(selectedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)),
), ),
Container( Container(
@ -132,12 +138,12 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
itemCount: dayEvents.length, itemCount: dayEvents.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
margin: EdgeInsets.only(right: (index==dayEvents.length-1)?16:5.0,left: index==0?16:5), margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5),
child: ButtonTheme( child: ButtonTheme(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
side: BorderSide( side: BorderSide(
color:index == selectedButtonIndex ? CustomColors.green:Colors.black, //Color of the border color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border
style: BorderStyle.solid, //Style of the border style: BorderStyle.solid, //Style of the border
width: 1.5, //width of the border width: 1.5, //width of the border
), ),
@ -345,14 +351,8 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
_events = value, _events = value,
if (widget.doctorSchedule != null) if (widget.doctorSchedule != null)
{ {
_calendarController.setSelectedDay( _calendarController.setSelectedDay(DateUtil.convertStringToDate(widget.doctorSchedule['Date']), isProgrammatic: true),
DateUtil.convertStringToDate( _onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date']), List())
widget.doctorSchedule['Date']),
isProgrammatic: true),
_onDaySelected(
DateUtil.convertStringToDate(
widget.doctorSchedule['Date']),
List())
} }
}); });
}); });

@ -28,7 +28,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
class AppointmentDetails extends StatefulWidget { class AppointmentDetails extends StatefulWidget {
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
static bool isLoading = false; static bool isLoading = false;
final dynamic doctorSchedule; dynamic doctorSchedule;
static bool showFooterButton = false; static bool showFooterButton = false;
final int parentIndex; final int parentIndex;
@ -182,9 +182,13 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: SchedulePage(doctorList: doctorList), page: SchedulePage(doctorList: doctorList, appo: widget.appo),
), ),
); ).then((value) {
setState(() {
widget.doctorSchedule = value;
});
});
}, },
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -586,7 +590,13 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
} }
void openSchedule() { void openSchedule() {
Navigator.push(context, FadePage(page: SchedulePage(doctorList: getDoctorObject()))); Navigator.push(
context,
FadePage(
page: SchedulePage(
doctorList: getDoctorObject(),
appo: widget.appo,
)));
} }
setTab() async { setTab() async {

@ -17,8 +17,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
class SchedulePage extends StatefulWidget { class SchedulePage extends StatefulWidget {
final DoctorList doctorList; DoctorList doctorList;
final AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
SchedulePage({ SchedulePage({
this.appo, this.appo,
this.doctorList, this.doctorList,
@ -202,14 +202,15 @@ class _SchedulePageState extends State<SchedulePage> {
openBookAppointment(selectedDate) { openBookAppointment(selectedDate) {
//sharedPref.setObject(DOCTOR_SCHEDULE_DATE_SEL, selectedDate); //sharedPref.setObject(DOCTOR_SCHEDULE_DATE_SEL, selectedDate);
Navigator.push( Navigator.of(context).pop(selectedDate);
context, // Navigator.push(
FadePage( // context,
page: AppointmentDetails( // FadePage(
appo: widget.appo, // page: AppointmentDetails(
doctorSchedule: selectedDate, // appo: widget.appo,
), // doctorSchedule: selectedDate,
), // ),
); // ),
// );
} }
} }

Loading…
Cancel
Save