Skip to content

Commit

Permalink
Added direction attribute to forward
Browse files Browse the repository at this point in the history
  • Loading branch information
vedartm committed Jul 27, 2020
1 parent 413b10a commit ae8134d
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 46 deletions.
9 changes: 3 additions & 6 deletions lib/src/cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';

import '../tcard.dart';
import 'animations.dart';
import 'swip_info.dart';

Expand All @@ -19,12 +20,8 @@ class TCardController {

int get index => _state?._frontCardIndex ?? 0;

forward() {
final bool isSwipLeft = math.Random().nextBool();
final SwipInfo swipInfo = isSwipLeft
? SwipInfo(_state._frontCardIndex, SwipDirection.Left)
: SwipInfo(_state._frontCardIndex, SwipDirection.Right);

forward({SwipDirection direction = SwipDirection.Right}) {
final SwipInfo swipInfo = SwipInfo(_state._frontCardIndex, direction);
_state._swipInfoList.add(swipInfo);
_state._runChangeOrderAnimation();
}
Expand Down
115 changes: 75 additions & 40 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,55 +1,62 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
clock:
collection:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection:
version: "1.14.12"
convert:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
fake_async:
version: "2.1.1"
crypto:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "2.1.4"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -60,27 +67,48 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.6.4"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -90,57 +118,64 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.15"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.7.0 <3.0.0"

0 comments on commit ae8134d

Please sign in to comment.