snaplist 0.1.5

  • Example
  • Installing
  • Versions
  • 93

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 #

Showscase gif

Include to your project #

In your pubspec.yaml root add:

  snaplist: ^0.1.5

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,

Properties #

There are 4 required fields:

  • sizeProvider is 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.
  • 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 - Children 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.

Snaplist defaults to horizontal scrolling. You can set axis to Axis.vertical for vertical scrolling.

Changelog #

[0.1.5] - 28.10.2018

  • Implements vertical axis scroll and snip. A big thanks to @raacker.

[0.1.4] - 27.10.2018

  • Adds a simple example to the package

[0.1.3] - 26.10.2018

  • Readme and organizational updates.

[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!


example #

A new Flutter project.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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

  snaplist: ^0.1.5

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages 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.68 points)

92 out of 93 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_bloc.dart.

Run flutter format to format lib/snaplist_bloc.dart.

Format lib/snaplist_events.dart.

Run flutter format to format lib/snaplist_events.dart.

Format lib/snaplist_view.dart.

Run flutter format to format lib/snaplist_view.dart.


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