// create a FreeScrollListView and use controller to add tail data or head data.
///controller
final FreeScrollListViewController _controller = FreeScrollListViewController();
// create list view
FreeScrollListView(
controller: _controller,
headerView: Container(
height: 60,
color: Colors.redAccent,
),
footerView: Container(
height: 60,
color: Colors.blue,
),
reverse: false,
/*willReachTail: () {
return _checkAddTail();
},
willReachHead: () {
return _checkAddHead();
},*/
builder: (context, index) {
return Container(
height: 75,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.black.withAlpha(20),
width: 0.5,
),
),
),
alignment: Alignment.center,
child: Text(
_controller.dataList[index],
),
);
},
)
//use scroll to index to scroll to any index you need.
_controller.scrollToIndex(
80,
);