Closed graemep-nz closed 8 months ago
I'm unable to reproduce this problem with a simple app (attached) but my real app is more complex. Here's the simple example that works correctly. It needs flutter_list_view from latest github test_flutter_listview.zip
Found the problem, I was using a key that was changing when it wasn't supposed to be.
I create a ScrollController in initState and pass it in a call to the FlutterListView constructor like this
and this is inside the build method of a class called say ClassX. The scroll controller works correctly initially until the constructor of ClassX reruns. The following sequence then happens /////////////////////////////////// ClassX constructor runs didUpdateWidget runs the build method starts the scroll controller gets attached to the listView a long list of unMount functions get called by the dart framework "a" scroll controller gets detached from "a" listview (by one of the unMount functions) the build method ends /////////////////////////////// now the scrollController no longer works.
If I create a brand new ScrollController in didUpdateWidget and pass that to the FlutterListView constructor, the new scroll controller keeps working. I don't really want to do this and surely I shouldn't have to. Does this seem like a bug in FlutterListView? Why does it think it needs to do a detach?