Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何使FixedExtentScrollController animateToItem方法仅在一个方向上设置滚动动画?(颤振)_Flutter_Dart_Flutter Animation_Dart Pub - Fatal编程技术网

Flutter 如何使FixedExtentScrollController animateToItem方法仅在一个方向上设置滚动动画?(颤振)

Flutter 如何使FixedExtentScrollController animateToItem方法仅在一个方向上设置滚动动画?(颤振),flutter,dart,flutter-animation,dart-pub,Flutter,Dart,Flutter Animation,Dart Pub,我正在尝试使用ListWheelScrollView.useDelegate()方法创建类似于老虎机的行为。以下是我目前掌握的情况: final FixedExtentScrollController\u controller=FixedExtentScrollController(); ... ListWheelScrollView.useDelegate( 控制器:_控制器, 物理:NeverScrollableScrollPhysics(),//用户将无法手动滚动 项目范围:50, chi

我正在尝试使用
ListWheelScrollView.useDelegate()
方法创建类似于老虎机的行为。以下是我目前掌握的情况:

final FixedExtentScrollController\u controller=FixedExtentScrollController();
...
ListWheelScrollView.useDelegate(
控制器:_控制器,
物理:NeverScrollableScrollPhysics(),//用户将无法手动滚动
项目范围:50,
childDelegate:ListWheelChildLoopingListDelegate(
孩子们:模特。所有浇头
.地图(
(顶部)=>容器(
颜色:color.fromRGBO(0,0,0,0.5),
身高:50,
宽度:50,
子项:Image.asset(top.Image),
),
)
.toList(),
),
),
我有一个“旋转”按钮,当点击时,它会以编程方式将
ListWheelScrollView
滚动到随机项

void userClickedSpin(){
最终随机数=新随机数();
最终int randomIndex=random.nextInt(allToppings.length);
controller.animateToItem(
随机指数,
持续时间:持续时间(毫秒:300),
曲线:Curves.FastOutSwowin,
);
}
问题是当我想要像吃角子老虎机那样只向一个方向旋转的行为时,
animateToItem
方法会向两个方向滚动。如何做到这一点

欢迎您的任何意见。谢谢大家!