ariedov/flutter_snaplist
关于
用于创建吸附列表的小型库。
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文snaplist
A small cozy library that allows you to make snappable list views.
Issues and Pull Requests are really appreciated!
Snaplist supports different and even dynamically sized children to be listed and correctly snapped.
Showcase

Include to your project
In your pubspec.yaml root add:
dependencies:
snaplist: ^0.1.8
Include
The library does provide StatefulWidget which is called SnapList.
Include the widget like this:
import 'package:snaplist/snaplist.dart';
Usage
Use it as you'd use any widget:
Widget build(BuildContext context) {
return SnapList(
sizeProvider: (index, data) => Size(100.0, 100.0),
separatorProvider: (index, data) => Size(10.0, 10.0),
builder: (context, index, data) => SizedBox(),
count: 1,
);
}
Snaplist uses gesture detection for swiping the list, so, please, be sure that the gestures you apply to the widgets inside are not overlapping for best user experience.
Properties
There are 4 required fields:
sizeProvideris a provider of each widget size. The library will wrap each built widget to a sized box of specified size. This is required so snapping calculations will work correctly.separatorProvideris similar tosizeProvider, but this size will be used to build the list separators.builderworks like a regularFlutterbuilder all of us are familiar with. It will pass you the context, current item index and some additional data.count- Children count as in aListView.
The data which is provided to each provider and the builder is a combination of three fields:
center- is the position which is now displayed and referenced as the center widget.next- is the position which the user is scrolling to. It is-1if idle.progress- is the scroll and snip progress. The values are from0to100.
Snaplist defaults to horizontal scrolling. You can set axis to Axis.vertical for vertical scrolling.
探索相关项目
加载中…