有没有什么插件或方法可以在flutter中实现这种滚动?
具体来说,请在右侧的字母列中进行突出显示,例如突出显示当前字母,或者如果点击了某个字母,则滚动视图将直接转到该字母标题。
为了按字母顺序排序,我们可以使用List.sort(),对于粘性标题,我们也有一些不错的插件。
查看这个插件粘头 https://pub.dartlang.org/packages/sticky_headers
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new ListView.builder(itemBuilder: (context, index) {
return new StickyHeader(
header: new Container(
height: 50.0,
color: Colors.blueGrey[700],
padding: new EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: new Text('Header #$index',
style: const TextStyle(color: Colors.white),
),
),
content: new Container(
child: new Image.network(imageForIndex(index), fit: BoxFit.cover,
width: double.infinity, height: 200.0),
),
);
});
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1428 次 |
| 最近记录: |