有没有任何插件或方法可以在 flutter 中实现这种滚动?
具体来说,右侧的字母列,例如突出显示当前字母表字母,或者如果点击某个字母,则滚动视图会直接转到该字母标题。
为了按字母顺序排序,我们可以这样做List.sort()
,对于粘性标题,我们也有一些不错的插件。
看看这个插件粘头https://pub.dartlang.org/packages/sticky_headers 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),
),
);
});
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)