|
|
|
|
@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
|
|
|
|
|
@ -25,8 +26,9 @@ import 'package:provider/provider.dart';
|
|
|
|
|
class TimeLineView extends StatefulWidget {
|
|
|
|
|
bool isLogged, isArabic;
|
|
|
|
|
List<AppoitmentAllHistoryResultList> appoitmentAllHistoryResultList;
|
|
|
|
|
MedicalViewModel medicalViewModel;
|
|
|
|
|
|
|
|
|
|
TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList);
|
|
|
|
|
TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList, this.medicalViewModel);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_TimeLineViewState createState() => _TimeLineViewState();
|
|
|
|
|
@ -40,19 +42,24 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
|
|
|
|
|
final authService = auth.AuthProvider();
|
|
|
|
|
|
|
|
|
|
ProjectViewModel? projectViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
// selectedDateObj = DateObj(DateTime.august, 2021, 2021.toString());
|
|
|
|
|
dateObjs.add(DateObj(0, 0, widget.isArabic ? "الكل" : "All"));
|
|
|
|
|
for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
tempList.add(widget.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
dateObjs.add(
|
|
|
|
|
DateObj(
|
|
|
|
|
DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!).month,
|
|
|
|
|
DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!).year,
|
|
|
|
|
dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All"));
|
|
|
|
|
for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
dateObjs.add(new DateObj(
|
|
|
|
|
DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).month,
|
|
|
|
|
DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).year,
|
|
|
|
|
DateUtil.getMonthYearLangDateFormatted(
|
|
|
|
|
DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!),
|
|
|
|
|
DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate),
|
|
|
|
|
widget.isArabic ? "ar" : "en",
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -71,17 +78,17 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
applyFilter(bool isAll) {
|
|
|
|
|
tempList.clear();
|
|
|
|
|
if (isAll) {
|
|
|
|
|
for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
tempList.add(widget.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) {
|
|
|
|
|
if (DateUtil.getMonthYearLangDateFormatted(
|
|
|
|
|
DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate!),
|
|
|
|
|
DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate),
|
|
|
|
|
widget.isArabic ? "ar" : "en",
|
|
|
|
|
) ==
|
|
|
|
|
selectedDateObj!.monthYear) {
|
|
|
|
|
tempList.add(widget.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -90,6 +97,7 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
return Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 210,
|
|
|
|
|
@ -172,27 +180,70 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
),
|
|
|
|
|
mFlex(1),
|
|
|
|
|
widget.isLogged
|
|
|
|
|
? Container(
|
|
|
|
|
height: widget.isArabic ? 130 : 110,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) => Padding(
|
|
|
|
|
padding: widget.isArabic
|
|
|
|
|
? EdgeInsets.only(left: index == 0 ? 0 : 12, right: (tempList.length - 1) == index ? 0 : 12)
|
|
|
|
|
: EdgeInsets.only(left: index == 0 ? 12 : 0, right: (tempList.length - 1) == index ? 12 : 0),
|
|
|
|
|
child: TimelineNewWidget(
|
|
|
|
|
appoitmentAllHistoryResul: tempList[index],
|
|
|
|
|
isLast: tempList.length - 1 == index ? true : false,
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: widget.isArabic ? 130 : 110,
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) => Padding(
|
|
|
|
|
padding: widget.isArabic
|
|
|
|
|
? EdgeInsets.only(left: index == 0 ? 0 : 12, right: (tempList.length - 1) == index ? 0 : 12)
|
|
|
|
|
: EdgeInsets.only(left: index == 0 ? 12 : 0, right: (tempList.length - 1) == index ? 12 : 0),
|
|
|
|
|
child: index < tempList.length
|
|
|
|
|
? TimelineNewWidget(
|
|
|
|
|
appoitmentAllHistoryResul: tempList[index],
|
|
|
|
|
isLast: tempList.length - 1 == index ? true : false,
|
|
|
|
|
)
|
|
|
|
|
: !projectViewModel!.isAllAppointmentsLoaded
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL);
|
|
|
|
|
widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false);
|
|
|
|
|
projectViewModel!.setIsAllAppointmentsLoaded(true);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
mHeight(22.0),
|
|
|
|
|
Container(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.arrow_forward_outlined,
|
|
|
|
|
color: CustomColors.white,
|
|
|
|
|
size: 30,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mHeight(6.0),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).loadMore,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: CustomColors.white,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.36,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
mWidth(24.0)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
),
|
|
|
|
|
itemCount: (tempList.length + 1),
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
shrinkWrap: false,
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return index < tempList.length ? mWidth(8) : Container();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
itemCount: tempList.length,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
shrinkWrap: false,
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return mWidth(8);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
@ -251,7 +302,7 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
height: MediaQuery.of(context).size.width / 14,
|
|
|
|
|
width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6),
|
|
|
|
|
child: CustomTextButton(
|
|
|
|
|
// shape: cardRadiusNew(8),
|
|
|
|
|
shape: cardRadiusNew(8),
|
|
|
|
|
elevation: 0,
|
|
|
|
|
backgroundColor: Color(0xFFFBF2E31),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
@ -323,7 +374,7 @@ class TimelineNewWidget extends StatelessWidget {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width / 2.3,
|
|
|
|
|
width: isLast! ? MediaQuery.of(context).size.width / 3.5 : MediaQuery.of(context).size.width / 2.5,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|