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.
71 lines
2.2 KiB
Dart
71 lines
2.2 KiB
Dart
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/widgets/upcomingCard.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ToDo extends StatefulWidget {
|
|
DoctorsListService service;
|
|
List<AppoitmentAllHistoryResultList> appoList = [];
|
|
|
|
@override
|
|
_ToDoState createState() => _ToDoState();
|
|
}
|
|
|
|
class _ToDoState extends State<ToDo> {
|
|
@override
|
|
void initState() {
|
|
widget.service = new DoctorsListService();
|
|
getPatientAppointmentHistory();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).todoList,
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
physics: ScrollPhysics(),
|
|
padding: EdgeInsets.all(0.0),
|
|
itemCount: widget.appoList.length,
|
|
itemBuilder: (context, index) {
|
|
return TodoListCard(
|
|
appo: widget.appoList[index],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
getPatientAppointmentHistory() {
|
|
widget.service.getPatientAppointmentHistory(true).then((res) {
|
|
print(res['AppoimentAllHistoryResultList']);
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
setState(() {
|
|
if (res['AppoimentAllHistoryResultList'].length != 0) {
|
|
widget.appoList.clear();
|
|
res['AppoimentAllHistoryResultList'].forEach((v) {
|
|
widget.appoList
|
|
.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
});
|
|
} else {}
|
|
});
|
|
print(widget.appoList.length);
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
print(err);
|
|
});
|
|
}
|
|
}
|