Skip to content
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

Merged
merged 5 commits into from Dec 15, 2022

Conversation

aydinfatih
Copy link
Contributor

@aydinfatih aydinfatih commented Apr 8, 2022

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.

  • New feature (non-breaking change which adds functionality)

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

  • Self Code Review
  • Tested on example project

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Changed the example project to contain the new feature (only if applies)

@BrunoJurkovic
Copy link
Owner

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

@@ -155,6 +157,10 @@ class FlipCardState extends State<FlipCard>
).animate(controller!);

widget.controller?.state = this;

if (widget.autoFlipDuration != null) {
Future.delayed(widget.autoFlipDuration!, () => toggleCard());
Copy link
Collaborator

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)

Copy link
Contributor Author

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;
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to documentation.

@ciriousjoker
Copy link
Collaborator

@aydinfatih I'd like to close this soon. Can you add the documentation for it please?

@aydinfatih
Copy link
Contributor Author

@ciriousjoker Sorry for late. I made the desired changes.

Copy link
Collaborator

@ciriousjoker ciriousjoker left a 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.
Copy link
Collaborator

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

lib/flip_card.dart Show resolved Hide resolved
@ciriousjoker
Copy link
Collaborator

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

@ciriousjoker ciriousjoker merged commit 2dfc6a7 into BrunoJurkovic:master Dec 15, 2022
@ciriousjoker
Copy link
Collaborator

@BrunoJurkovic Can you please publish a new version to pub.dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants