flutter - AnimationController animateTo method, always going back to start
问题描述
I am using AnimationController.animateTo method to jump my animation to specific points instantly.
When I pass parameter 'target' with a value of 0.0 to animateTo method, the resulting 'value' property of AnimationController is 0.0. If I pass a parameter 'target' to animateTo method with a value of 0.5, the resulting 'value' property of AnimationController still returns 0.0. I would expect the 'value' property to return 0.5.
void _onPlayButtonPressed() {
final cpm = ScopedModel.of<CpModel>(context);
if (cpm.started) {
cpm.stop();
_animController.stop();
var targetProgress = cpm.adjustedProgress;
_animController.animateTo(targetProgress , duration: Duration(seconds: 0));
} else {
_ranOnce = true;
cpm.start();
_animController.forward();
}
}
解决方案
推荐阅读
- javascript - 更改页面 Spring Boot 应用程序
- javascript - 使用 Javascript 有没有办法将信息推送到键/值对之外的数组中?
- reactjs - 无法让 Cypress 测试与 Okta 一起在 React 中工作
- powershell - Microsoft GraphAPI PowerShell 下载附件
- android - 使用 Parse 和 back4app 推送通知 Android | 使用 GCM 发件人 ID 发出问题
- mysql - 计算 2 个子查询然后按日期分组 - mysql
- javascript - 服务工作者:使用 IndexedDB 缓存 POST 请求 - 安全问题
- excel - Excel中水平文本数组的模式
- ipfs - IPFS 中的可变文件系统与常规文件 API
- flutter - Flutter,Facebook Audience Network 广告横幅在进入另一个屏幕时不显示