snaplist 0.1.2 copy "snaplist: ^0.1.2" to clipboard
snaplist: ^0.1.2 copied to clipboard

outdated

A new flutter package project.

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:

dependencies:
  snaplist:
    git:
      url: https://github.com/ariedov/flutter_snaplist.git

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.
33
likes
0
pub points
76%
popularity

Publisher

unverified uploader

A new flutter package project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on snaplist