微信交流群

老孟公众号

# DraggableScrollableActuator

通知子控件DraggableScrollableSheet重置其位置到初始化状态,调用DraggableScrollableActuator.reset(context)方法即可。

DraggableScrollableActuator(child: DraggableScrollableSheet(
    builder:
        (BuildContext context, ScrollController scrollController) {
  return Container(
    color: Colors.blue[100],
    child: ListView.builder(
      controller: scrollController,
      itemCount: 100,
      itemBuilder: (BuildContext context, int index) {
        return ListTile(
          title: Text('评论 $index'),
          onTap: () {
            DraggableScrollableActuator.reset(context);
          },
        );
      },
    ),
  );
}))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

点击时调用DraggableScrollableActuator.reset(context),立即回到初始位置,

DraggableScrollableActuator