flutter_tindercard 0.1.8

flutter_tindercard #

Pub Closed

Tinder/TanTan Card Widget.

Screenshots #

screenshot

Getting Started #

  1. Depend on it by adding this to your pubspec.yaml file: flutter_tindercard: ^0.1.7

  2. Import it: import 'package:flutter_tindercard.dart'

  3. Add TinderSwapCard in your widget layout and write the single card layout builder you need, then you get a Tinder(探探) like swap card widget!

  4. Use CardSwipeCompleteCallback for the swiped orientation and index!

  5. Use CardController to trigger swap from outside. Init a CardController as param for widget, and invoke method triggerLeft/Right of your CardController to trigger swipe!

  6. Use CardDragUpdateCallback to get swiping card's detail.

Example #

See Here

0.1.4 #

  • add CardSwipeCompleteCallback for the swiped orientation:
  • add CardDragUpdateCallback for the swiping position.

0.1.5 #

  • update CardSwipeCompleteCallback with the card's index param:

0.1.6 #

  • add CardController to trigger swap from outside.

0.1.7 #

  • add animDuration param to custom.
  • Optimize the animation.

0.1.8 #

  • update CardDragUpdateCallback for the swiping card's detail.
  • add swipeEdge to determine action(recover or swipe) when you release your swiping card.

example/example.dart

import 'package:flutter/material.dart';
import 'package:flutter_tindercard/flutter_tindercard.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ExampleHomePage(),
    );
  }
}

class ExampleHomePage extends StatefulWidget {
  @override
  _ExampleHomePageState createState() => _ExampleHomePageState();
}

class _ExampleHomePageState extends State<ExampleHomePage>
    with TickerProviderStateMixin {
  List<String> welcomeImages = [
    "assets/welcome0.png",
    "assets/welcome1.png",
    "assets/welcome2.png",
    "assets/welcome2.png",
    "assets/welcome1.png",
    "assets/welcome1.png"
  ];

  @override
  Widget build(BuildContext context) {
    CardController controller; //Use this to trigger swap.

    return new Scaffold(
      body: new Center(
          child: Container(
              height: MediaQuery.of(context).size.height * 0.6,
              child: new TinderSwapCard(
                  orientation: AmassOrientation.BOTTOM,
                  totalNum: 6,
                  stackNum: 3,
                  swipeEdge: 4.0,
                  maxWidth: MediaQuery.of(context).size.width * 0.9,
                  maxHeight: MediaQuery.of(context).size.width * 0.9,
                  minWidth: MediaQuery.of(context).size.width * 0.8,
                  minHeight: MediaQuery.of(context).size.width * 0.8,
                  cardBuilder: (context, index) => Card(
                        child: Image.asset('${welcomeImages[index]}'),
                      ),
                  cardController: controller = CardController(),
                  swipeUpdateCallback:
                      (DragUpdateDetails details, Alignment align) {
                    /// Get swiping card's alignment
                    if (align.x < 0) {
                      //Card is LEFT swiping
                    } else if (align.x > 0) {
                      //Card is RIGHT swiping
                    }
                  },
                  swipeCompleteCallback:
                      (CardSwipeOrientation orientation, int index) {
                    /// Get orientation & index of swiped card!
                  }))),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_tindercard: ^0.1.8

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:flutter_tindercard/flutter_tindercard.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
85
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]
92
Learn more about scoring.

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

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flutter_tindercard.dart. (-0.50 points)

Analysis of lib/flutter_tindercard.dart reported 1 hint:

line 10 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: TinderSwapCard._cardBuilder, TinderSwapCard._totalNum, TinderSwapCard._stackNum, TinderSwapCard._animDuration, TinderSwapCard._swipeEdge, TinderSwapCard.swipeCompleteCallback, TinderSwapCard.swipeUpdateCallback, TinderSwapCard.cardController

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 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