snaplist 0.1.2

  • Installing
  • Versions
  • 87

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 childs to be listed and correctly snapped.

Showcase #

Showscase gif

Include to your project #

In your pubspec.yaml root add:


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,

There are 4 required fields:

  • sizeProvider is a provider of each widget size. The library will wrap each builded widget to a sized box of specified size. This is required so snapping calculations will work correctly.
  • separatorProvider is similar to sizeProvider, but this size will be used to build the list separators.
  • builder works like a regular Flutter builder all of us are familiar with. It will pass you the context, current item index and some additional data.
  • count - child count. As in a ListView.

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 -1 if idle.
  • progress - is the scroll and snip progress. The values are from 0 to 100.

Changelog #

[0.1.2] - 25.10.2018

  • Implements snapping back to original item if not enough velocity or progress

[0.1.1] - 24.10.2018

  • Explicitly provides current item position, does not hide it in builder data
  • Removes unnessesary setState calls from snip animation

[0.1.0] - 21.10.2018

  • It's alive!

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  snaplist: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:snaplist/snaplist.dart';
Version Uploaded Documentation Archive
0.1.8 Mar 15, 2019 Go to the documentation of snaplist 0.1.8 Download snaplist 0.1.8 archive
0.1.7 Feb 1, 2019 Go to the documentation of snaplist 0.1.7 Download snaplist 0.1.7 archive
0.1.6 Oct 31, 2018 Go to the documentation of snaplist 0.1.6 Download snaplist 0.1.6 archive
0.1.5 Oct 28, 2018 Go to the documentation of snaplist 0.1.5 Download snaplist 0.1.5 archive
0.1.4 Oct 27, 2018 Go to the documentation of snaplist 0.1.4 Download snaplist 0.1.4 archive
0.1.3 Oct 26, 2018 Go to the documentation of snaplist 0.1.3 Download snaplist 0.1.3 archive
0.1.2 Oct 26, 2018 Go to the documentation of snaplist 0.1.2 Download snaplist 0.1.2 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15
  • Flutter: 1.5.8


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.66 points)

87 out of 88 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/snaplist.dart.

Run flutter format to format lib/snaplist.dart.

Format lib/snaplist_events.dart.

Run flutter format to format lib/snaplist_events.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and snaplist.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies