|
|
|
|
|
|
|
|
return Center(child: Text(label_list_empty)); |
|
|
return Center(child: Text(label_list_empty)); |
|
|
} |
|
|
} |
|
|
List<Activities> currentItems = List<Activities>.from(state.items); |
|
|
List<Activities> currentItems = List<Activities>.from(state.items); |
|
|
return RefreshIndicator( |
|
|
|
|
|
child: Column( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
|
|
|
height: 40, |
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
|
|
body: RefreshIndicator( |
|
|
|
|
|
child: Column( |
|
|
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
alignment: Alignment.center, |
|
|
alignment: Alignment.center, |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: COLOR_CONST.WHITE_50, |
|
|
color: COLOR_CONST.WHITE_50, |
|
|
|
|
|
|
|
|
bottom: BorderSide( |
|
|
bottom: BorderSide( |
|
|
width: 0.5, color: COLOR_CONST.DEFAULT)), |
|
|
width: 0.5, color: COLOR_CONST.DEFAULT)), |
|
|
), |
|
|
), |
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
plot_detail_title, |
|
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 20, fontWeight: FontWeight.normal), |
|
|
|
|
|
)), |
|
|
|
|
|
IconButton( |
|
|
|
|
|
icon: (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) |
|
|
|
|
|
? Icon(Icons.arrow_upward) |
|
|
|
|
|
: Icon(Icons.arrow_downward), |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
if (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) { |
|
|
|
|
|
widget.parentScroll.animateTo( |
|
|
|
|
|
heightOfActionButton, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} else { |
|
|
|
|
|
widget.parentScroll.animateTo(0.0, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
], |
|
|
|
|
|
)), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: ListView.builder( |
|
|
|
|
|
physics: AlwaysScrollableScrollPhysics(), |
|
|
|
|
|
itemBuilder: (BuildContext context, int index) { |
|
|
|
|
|
return index >= state.items.length |
|
|
|
|
|
? BottomLoader() |
|
|
|
|
|
: ItemInfinityWidget( |
|
|
|
|
|
currentItems: currentItems, |
|
|
|
|
|
item: state.items[index], |
|
|
|
|
|
currentPage: state.page, |
|
|
|
|
|
currentReachedMax: state.hasReachedMax); |
|
|
|
|
|
}, |
|
|
|
|
|
itemCount: state.hasReachedMax |
|
|
|
|
|
? state.items.length |
|
|
|
|
|
: state.items.length + 1, |
|
|
|
|
|
controller: _scrollController, |
|
|
|
|
|
)) |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
onRefresh: () async { |
|
|
|
|
|
widget.plotDetailBloc.add(OnRefresh( |
|
|
|
|
|
cropId: widget.cropId, cropCode: widget.cropCode)); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
height: 40, |
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
plot_detail_title, |
|
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 20, fontWeight: FontWeight.normal), |
|
|
|
|
|
)), |
|
|
|
|
|
GestureDetector( |
|
|
|
|
|
child: (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) |
|
|
|
|
|
? Icon(Icons.arrow_upward) |
|
|
|
|
|
: Icon(Icons.arrow_downward_outlined), |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
if (widget.parentScroll.position.pixels < |
|
|
|
|
|
heightOfActionButton) { |
|
|
|
|
|
widget.parentScroll.animateTo( |
|
|
|
|
|
heightOfActionButton, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} else { |
|
|
|
|
|
widget.parentScroll.animateTo(0.0, |
|
|
|
|
|
duration: Duration(milliseconds: 500), |
|
|
|
|
|
curve: Curves.easeOut); |
|
|
|
|
|
} |
|
|
|
|
|
}), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: ListView.builder( |
|
|
|
|
|
physics: AlwaysScrollableScrollPhysics(), |
|
|
|
|
|
itemBuilder: (BuildContext context, int index) { |
|
|
|
|
|
return index >= state.items.length |
|
|
|
|
|
? BottomLoader() |
|
|
|
|
|
: ItemInfinityWidget( |
|
|
|
|
|
currentItems: currentItems, |
|
|
|
|
|
item: state.items[index], |
|
|
|
|
|
currentPage: state.page, |
|
|
|
|
|
currentReachedMax: state.hasReachedMax); |
|
|
|
|
|
}, |
|
|
|
|
|
itemCount: state.hasReachedMax |
|
|
|
|
|
? state.items.length |
|
|
|
|
|
: state.items.length + 1, |
|
|
|
|
|
controller: _scrollController, |
|
|
|
|
|
)) |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
onRefresh: () async { |
|
|
|
|
|
widget.plotDetailBloc.add(OnRefresh( |
|
|
|
|
|
cropId: widget.cropId, cropCode: widget.cropCode)); |
|
|
|
|
|
}), |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
return Center( |
|
|
return Center( |
|
|
child: LoadingListPage(), |
|
|
child: LoadingListPage(), |