Problem:
Initially I have disabled ListView scrolling, and want to enable it after 3 seconds. The moment app launches and you keep scrolling it for like 5 seconds (without lifting your finger off the screen), the ListView doesn't scroll.
However it should have scrolled because I am enabling scrolling at 3rd second, the console confirms ListView enabled but still I am not able to scroll it.
Code:
bool _enabled = false; // scrolling disabled initially
@override
void initState() {
super.initState();
Timer(Duration(seconds: 3), () {
print("Scrolling enabled");
setState(() => _enabled = true); // scrolling enabled after 3 seconds
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView.builder(
physics: _enabled ? ClampingScrollPhysics() : NeverScrollableScrollPhysics(),
itemBuilder: (_, i) => ListTile(title: Text("Item $i")),
),
);
}