2

I used Flutter Linuix:

I had a few basic children that need to scroll a little bit so I needed a listview to enable scrolling and got this exception a smple code like this:

ListView(
  children: [
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
  ],
)

The following assertion was thrown while notifying status listeners for AnimationController: The provided ScrollController is currently attached to more than one ScrollPosition.

Abdelrahman Tareq
  • 1,874
  • 3
  • 17
  • 32

2 Answers2

12

The solution is simple just add controllor to the listveiw like this:

ListView(
      controller: ScrollController(),
  children: [
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
    Text(
      'data',
      style: TextStyle(fontSize: 215),
    ),
  ],
)

source:

https://github.com/flutter/flutter/issues/85456

Abdelrahman Tareq
  • 1,874
  • 3
  • 17
  • 32
0

To get rid of this error you could wrap your widget tree in a ScrollConfiguration:

ScrollConfiguration(
          behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
          child: ListView()
tom_keys
  • 11
  • 2