swipe_stack 1.0.0

  • Readme
  • Changelog
  • Installing
  • 81

swipe_stack #

Swipe stack flutter.

Screenshot #

Youtube Video

Installation #

Add

swipe_stack : ^latest_version

to your pubspec.yaml.

Usage #

ParameterDefaultDescription
maxAngle35Maximum rotation value. Must be int between 0 and 360
threshold30Manual swipe is canceled when the card is dragged less than threshold. Must be int between 1 and 100
stackFromStackFrom.NoneStack type. Must be one of StackFrom.Left, StackFrom.Right, StackFrom.Top, StackFrom.Bottom, StackFrom.None
visibleCount2Number of objects to display. Must int and at least 2
translationInterval0Distance between objects. Must be positive integer
scaleInterval0Decreasing scale value. Must be positive double
animationDurationDuration(milliseconds: 200)Animation duration
historyCount1Number of objects to keep in the history. Must be positive integer
paddingEdgeInsets.symmetric(vertical: 20, horizontal: 25)Main container padding
SwipeStack(
    children: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((int index) {
        return SwiperItem(
            builder: (SwiperPosition position, double progress) {
                return Material(
                    elevation: 4,
                    borderRadius: BorderRadius.all(Radius.circular(6)),
                    child: Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.all(Radius.circular(6)),
                        ),
                        child: Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: <Widget>[
                                Text("Item $index", style: TextStyle(color: Colors.black, fontSize: 20)),
                                Text("Progress $progress", style: TextStyle(color: Colors.blue, fontSize: 12)),
                            ],
                        )
                    )
                );
            }
        );
    }).toList(),
    visibleCount: 3,
    stackFrom: StackFrom.Top,
    translationInterval: 6,
    scaleInterval: 0.03,
    onEnd: () => debugPrint("onEnd"),
    onSwipe: (int index, SwiperPosition position) => debugPrint("onSwipe $index $position"),
    onRewind: (int index, SwiperPosition position) => debugPrint("onRewind $index $position"),
)

Manuel Usage #

final GlobalKey<SwipeStackState> _swipeKey = GlobalKey<SwipeStackState>();
SwipeStack(
    key: _swipeKey,
    ...,
)
_swipeKey.currentState.swipeLeft();
_swipeKey.currentState.swipeRight();
_swipeKey.currentState.rewind();

[1.0.0] - TODO: Add release date.

Use this package as a library

1. Depend on it

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


dependencies:
  swipe_stack: ^1.0.0

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

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

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/swipe_stack.dart.

Run flutter format to format lib/swipe_stack.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 swipe_stack.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8