Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo snap list

snap list is a small cozy flutter library that allows you to make snappable list views.

issues and pull requests are really appreciated!

snap list supports different and even dynamically sized children to be listed and correctly snapped.

snap list

include to your project

in your pubspec.yaml root add:

dependencies:
  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.

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.