parallax_swiper 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 57

parallax_swiper #

A swiper widget with parallax effect with support for both swipe directions.

Installation #

Add parallax_swiper: ^0.0.1 to your pubspec.yaml file. Import it by adding to your file:

import 'package: parallax_swiper/parallax_swiper.dart'

Use #

Create a ParallaxSwiper widget and pass the required parameters.

ParallaxSwiper(
    backgroundWidget: bgWidget,
    foregroundWidgets: <Widget>[fgWidget1, fgWidget2, fgWidget3],
)

Parameters #

ParallaxSwiper(
    backgroundWidget: bgWidget,
    foregroundWidgets: <Widget>[fgWidget1, fgWidget2, fgWidget3],
    alignment: Alignment.center,
    returnDuration: Duration(milliseconds: 1000),
    returnCurve: Curves.easeOut,
    backgroundRotationFactor: 0.001,
    foregroundRotationFactor: 0.001,
    foregroundTranslationFactor: 0.2,
    swiperHeight: 300,
    swiperInitialPage: 0,
    swiperInfiniteSwipe = false,
    swipeDirection: Axis.vertical,
    swiperDuration: Duration(milliseconds: 500),
    swiperCurve: Curves.easeOut,
    onItemChanged: onItemChangeCallback,
    onTap: onTapCallback,
    onDoubleTap: onDoubleTapCallback,
    onLongPress: onLongPressCallback,
)

backgroundWidget - Widget
The widget to be displayed in the background.

foregroundWidgets - List<Widget>
A list of widgets to be displayed in the foreground and be swiped.

alignment - Alignment
The alignment in the widget stack, default Alignment.center.

returnDuration - Duration
The amount of time for the widget to return to the center position after a drag ends.

returnCurve - Curve
The curve for the return animation after a drag ends.

backgroundRotationFactor - double
The amount of rotation for the background.

foregroundRotationFactor - double
The amount of rotation for the foreground.

foregroundTranslationFactor - double
The amount of translation for the foreground.

swiperHeight - double
The height of the foreground swiper.

swiperInitialPage - int
The initial page/item to be shown by the swiper.

swiperInfiniteSwipe - bool
Set the swipe to be infinite or limited to the amount of items in the foregroundWidgets list.

swipeDirection - Axis
The direction of the swipe.

swiperDuration - Duration
The duration of the animation of the swipe.

swiperCurve - Curve
The curve of the animation of the swipe

onItemChanged - Function
Callback function for when an item changed in the swiper.

onTap - Function
Callback function after a tap on the widget.

onDoubleTap - Function
Callback function after a double tap on the widget.

onLongPress - Function
Callback function after a long press on the widget.

Example #

Horizontal swipe
horizontal_swipe.gif

Vertical swipe
vertical_swipe.gif

Credits #

Example images source: Super Mario Wiki
Example font: Super Mario 256 by fsuarez913

0.0.1 #

Initial release.

example/README.md

parallax_swiper_example #

An example of the use of parallax_swiper.

Use this package as a library

1. Depend on it

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


dependencies:
  parallax_swiper: ^0.0.1

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

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

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