flutter - 慢慢滚动列表
问题描述
我希望能够滚动到列中的特定小部件。此解决方案有效,但我找不到滚动速度较慢的方法,因为使用此方法您可以立即到达小部件。我也不能使用滚动索引包,因为我的小部件在滚动时应该是动画的,这是不可能的。有谁知道如何通过这个列表更慢地滚动?
class ScrollView extends StatelessWidget {
final dataKey = new GlobalKey();
@override
Widget build(BuildContext context) {
return new Scaffold(
primary: true,
appBar: new AppBar(
title: const Text('Home'),
),
body: new SingleChildScrollView(
child: new Column(
children: <Widget>[
new SizedBox(height: 160.0, width: double.infinity, child: new Card()),
new SizedBox(height: 160.0, width: double.infinity, child: new Card()),
new SizedBox(height: 160.0, width: double.infinity, child: new Card()),
// destination
new Card(
key: dataKey,
child: new Text("data\n\n\n\n\n\ndata"),
)
],
),
),
bottomNavigationBar: new RaisedButton(
onPressed: () => Scrollable.ensureVisible(dataKey.currentContext),
child: new Text("Scroll to data"),
),
);
}
}
解决方案
推荐阅读
- c# - WPF DependencyProperty 继承 - 常规 DP 与附加
- c# - c#序列化创建一个空文件
- python-3.x - 在网格的特定部分应用纹理
- webpack - Tapable.plugin 已弃用
- mysql - MYSQL 基于时间的优化 | 加入电话号码表和最近通话的通话日期
- java - 用 Big-O 表示法计算运行时间
- r - 使用 geom_smooth 后求 R^2
- phpunit - 无法设置夹具(带有 dbunit 的 PHPunit)
- heroku - Heroku Connect:延长错误日志持续时间和 UNABLE_TO_LOCK_ROW 错误
- javascript - 将图像添加到 ajax 中的上传