{"id":4314,"date":"2024-11-29T09:05:56","date_gmt":"2024-11-29T09:05:56","guid":{"rendered":"https:\/\/www.qworqs.com\/blog\/?p=4314"},"modified":"2024-11-29T09:05:56","modified_gmt":"2024-11-29T09:05:56","slug":"flutter-no-scrollposition-attached-solved","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2024\/11\/29\/flutter-no-scrollposition-attached-solved\/","title":{"rendered":"Flutter &#8220;no ScrollPosition attached&#8221; SOLVED"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Exception caught by animation library \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550<br>The Scrollbar's ScrollController has no ScrollPosition attached.<\/pre>\n\n\n\n<p>The solution to this problem turned out to be, to assign the same scroll controller that I have assigned to the ListView.builder to the Scrollbar !<\/p>\n\n\n\n<p>This problem didn&#8217;t exist not long ago, but since the solution is simple, here is a sample code snippet !<\/p>\n\n\n\n<p>So the code to fix was simply this<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Widget _buildParticipantDisplay() {<br>    return Scrollbar(<br>      interactive: true,<br>      controller: <strong>scrollController<\/strong>,<br>      child: ListView.builder(<br>        itemCount: participants.length,<br>        controller: <strong>scrollController<\/strong>,<br>        itemExtent: 60,<br>        itemBuilder: (context, index) {<br>          return ListTile(<br>            contentPadding: EdgeInsets.symmetric(horizontal: 50),<br>            title: Text('participant: ${index + 1}'),<br>            trailing: Text(participants[index]),<br>          );<br>        },<br>      ),<br>    );<br>  }<br><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Exception caught by animation library \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550The Scrollbar&#8217;s ScrollController has no ScrollPosition attached. The solution to this problem turned out to be, to assign the same scroll controller that I have assigned to the ListView.builder to the Scrollbar ! This problem didn&#8217;t exist not long ago, but since the solution is simple, here is a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203],"tags":[],"class_list":["post-4314","post","type-post","status-publish","format-standard","hentry","category-dart-flutter"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=4314"}],"version-history":[{"count":3,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4314\/revisions"}],"predecessor-version":[{"id":4317,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4314\/revisions\/4317"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=4314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=4314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=4314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}