|
|
|
|
@ -40,23 +40,16 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
DateObj selectedDateObj = null;
|
|
|
|
|
final authService = new auth.AuthProvider();
|
|
|
|
|
|
|
|
|
|
static const _scrollThreshold = 1.00;
|
|
|
|
|
ScrollController _scrollController;
|
|
|
|
|
|
|
|
|
|
bool isAllAppointmentsLoaded = false;
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_scrollController.removeListener(_scrollListener);
|
|
|
|
|
_scrollController.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_scrollController = ScrollController();
|
|
|
|
|
_scrollController.addListener(_scrollListener);
|
|
|
|
|
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]);
|
|
|
|
|
@ -77,17 +70,6 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _scrollListener() async {
|
|
|
|
|
if (_scrollController.offset >= _scrollController.position.maxScrollExtent * _scrollThreshold && !_scrollController.position.outOfRange) {
|
|
|
|
|
print('Scroll position is at ${_scrollThreshold * 100}%.');
|
|
|
|
|
if(!isAllAppointmentsLoaded) {
|
|
|
|
|
await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL);
|
|
|
|
|
widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false);
|
|
|
|
|
isAllAppointmentsLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
applyFilter(bool isAll) {
|
|
|
|
|
tempList.clear();
|
|
|
|
|
if (isAll) {
|
|
|
|
|
@ -110,6 +92,7 @@ class _TimeLineViewState extends State<TimeLineView> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
return Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 210,
|
|
|
|
|
@ -192,28 +175,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(),
|
|
|
|
|
controller: _scrollController,
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return mWidth(8);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
@ -344,7 +369,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,
|
|
|
|
|
|