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.
PatientApp-KKUMC/lib/pages/MyAppointments/VisitTicket.dart

74 lines
2.6 KiB
Dart

import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
class VisitTicket extends StatefulWidget {
List<DoctorList> appoList = [];
@override
_VisitTicketState createState() => _VisitTicketState();
}
class _VisitTicketState extends State<VisitTicket> {
bool isLoading = false;
@override
void initState() {
getPatientAppointmentCurfewHistory(context);
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).todoList,
body: isLoading == false
? SingleChildScrollView(
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: widget.appoList.length,
itemBuilder: (context, index) {
return DoctorView(
doctor: widget.appoList[index],
);
},
),
)
: AppCircularProgressIndicator(),
);
}
getPatientAppointmentCurfewHistory(BuildContext context) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.getPatientAppointmentHistory(true, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
setState(() {
if (res['AppoimentAllHistoryResultList'].length != 0) {
widget.appoList.clear();
res['AppoimentAllHistoryResultList'].forEach((v) {
widget.appoList.add(new DoctorList.fromJson(v));
});
} else {}
});
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
}