I have a Pageview scroll which can be scrolled in up and down direction. Can i make it to scroll only downwards once scrolled down cannot go up . I googled but i haven't found anything useful
Update :
class _ScrollDownOnlyState extends State<ScrollDownOnly> {
bool checkDir = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Down scroll"),
),
body: PageView.builder(
scrollDirection: Axis.vertical,
physics: checkDir ? const NeverScrollableScrollPhysics() : const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
print("checl $checkDir");
return GestureDetector(
onPanUpdate: (details) {
print(details.delta.dy);
if (details.delta.dy > 0) {
setState(() {
checkDir = true;
});
}
if (details.delta.dy < 0) {
// set your var
setState(() {
checkDir = false;
});
}
},
child: Container(
margin: EdgeInsets.only(top: 20),
color: Colors.pink,
child: Center(
child: Text(
"${index + 1}",
style: TextStyle(color: Colors.white, fontSize: 30),
),
),
),
);
},
itemCount: 50,
),
);
}
}