snaplist 0.1.6

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new84

awesome flutter pub package

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:

dependencies:
  snaplist: ^0.1.6

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:

  • 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.6] - 31.10.2018

  • Hot reload did nothing to snaplist. Now it is fixed. A big thanks to @raacker.

[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/README.md

example

Sample app for the Snaplist library.

showcase.

This application shows two uses case of using snaplist - vertical and horizontal snapping.

The only actual difference between those two is the axis value. But I still believe it is important considering both options, especially if you are providing some additional gestures to the displayed item.

Please, be sure that your gesture does not conflict with the gesture which is used for the list scroll and snaps.

Use this package as a library

1. Depend on it

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


dependencies:
  snaplist: ^0.1.6

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.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
Popularity:
Describes how popular the package is relative to other packages. [more]
69
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test