title: 'DraggableScrollableActuator' description: '' type: widget
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);
},
);
},
),
);
}))
点击时调用DraggableScrollableActuator.reset(context)
,立即回到初始位置,