I'm having a Column widget which contain a list of widgets. And this column is inside a SingleChildScrollView. For some reasons I need to autoscroll to the third child of the column while clicking the floating button.

My code looks somewhat like this.

SingleChildScrollView(
        child: Column(
          children: [
            Column(
              children:[ getWidget1(), getWidget2(), getWidget3()],
            ),
          ],
  ),
),


Solution 1: Emre Faruk KOLAÇ

Use ScrollablePositionedList instead. Create the controller

  final ItemScrollController itemScrollController = ItemScrollController();

Create scroll function

  void scrollTo(int index) {
    itemScrollController.scrollTo(index: index, duration: scrollDuration, curve: Curves.easeInOutCubic, alignment: 0);
  }

Assign it to ListBuilder

ScrollablePositionedList.builder(
              key: Key('builder $selected'), //attention
              itemCount: itemlength,
              itemScrollController: itemScrollController,
              itemPositionsListener: itemPositionsListener,
              itemBuilder: (context, index) {
                return `yourWidgets`}
            ),

Call it

ElevatedButton(
onTap:()=> scrollTo("your index here"),
child:...)


Solution 2: Sachin Kumawat

you can see scroll_loop_auto_scroll: ^0.0.5 may be helpful