flutter_tindercard 0.1.6

flutter_tindercard #

Tinder/TanTan Card Widget.

Screenshots #

screenshot

Getting Started #

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

  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!

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.

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,
                  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) {
                    /// Get swiping card's position
                  },
                  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.6

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]
79
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]
89
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

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

Admin