New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added autoFlipDuration parameter #64
Conversation
Thanks for your enhancement and for your time, and my apology for the delayed response. This seems like a nice little feature to add. @aydinfatih Could you please write some documentation for this? Thank you :) |
lib/flip_card.dart
Outdated
@@ -155,6 +157,10 @@ class FlipCardState extends State<FlipCard> | |||
).animate(controller!); | |||
|
|||
widget.controller?.state = this; | |||
|
|||
if (widget.autoFlipDuration != null) { | |||
Future.delayed(widget.autoFlipDuration!, () => toggleCard()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just pass toggleCard
directly as the second parameter (without creating an anonymous function to call it yourself)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it.
@@ -60,6 +60,7 @@ class FlipCard extends StatefulWidget { | |||
final FlipCardController? controller; | |||
final Fill fill; | |||
final CardSide side; | |||
final Duration? autoFlipDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please documentation for this feature, ideally as a /// comment
above the autoFlipDuration, but also in the readme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to documentation.
@aydinfatih I'd like to close this soon. Can you add the documentation for it please? |
@ciriousjoker Sorry for late. I made the desired changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, just some minor improvements
You can auto-flip the widget after a certain delay without any external triggering. | ||
```dart | ||
FlipCard( | ||
fill: Fill.fillBack, // Fill the back side of the card to make in the same size as the front. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably combine all of these into
(
...,
autoFlipDuration ...
)
@aydinfatih I'll probably merge this at the end of next week. If you make any changes until then I'll review them, otherwise consider it merged. |
@BrunoJurkovic Can you please publish a new version to pub.dev? |
Description
Added one-time autoFlip feature without a FlipCardController. For example, a one-time flip can be played for the logo or the cards that need to be loaded once.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I tested it on my own project. The following parameter should be added to the FlipCard widget.
autoFlipDuration: Duration(milliseconds: 1000),
Checklist: