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

Make filterQuality configurable #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/flip_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class FlipCard extends StatefulWidget {
this.fill = Fill.none,
this.initialSide = CardSide.front,
this.autoFlipDuration,
this.filterQuality,
});

/// The initially shown side of the card
Expand Down Expand Up @@ -112,6 +113,9 @@ class FlipCard extends StatefulWidget {
/// {@macro flip_card.FlipCardTransition.fill}
final Fill fill;

/// {@macro flip_card.FlipTransition.filterQuality}
final FilterQuality? filterQuality;

/// When enabled, the card will flip automatically when touched. This behavior
/// can be disabled if this is not desired.
///
Expand Down Expand Up @@ -315,6 +319,7 @@ class FlipCardState extends State<FlipCard>
direction: widget.direction,
fill: widget.fill,
alignment: widget.alignment,
filterQuality: widget.filterQuality,
);

/// if we need to flip the card on taps, wrap the content
Expand Down
14 changes: 13 additions & 1 deletion lib/src/flip_card_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class FlipCardTransition extends StatefulWidget {
this.alignment = Alignment.center,
this.frontAnimator,
this.backAnimator,
this.filterQuality,
});

/// {@template flip_card.FlipCardTransition.front}
Expand Down Expand Up @@ -52,6 +53,9 @@ class FlipCardTransition extends StatefulWidget {
/// {@endtemplate}
final Alignment alignment;

/// {@macro flip_card.FlipTransition.filterQuality}
final FilterQuality? filterQuality;

/// The [Animatable] used to animate the front side
final Animatable<double>? frontAnimator;

Expand Down Expand Up @@ -161,6 +165,7 @@ class _FlipCardTransitionState extends State<FlipCardTransition> {
: (widget.backAnimator ?? FlipCardTransition.defaultBackAnimator)
.animate(widget.animation),
direction: widget.direction,
filterQuality: widget.filterQuality,
child: child,
),
);
Expand All @@ -177,6 +182,7 @@ class FlipTransition extends AnimatedWidget {
required this.child,
required this.animation,
required this.direction,
required this.filterQuality,
}) : super(listenable: animation);

/// The [Animation] that controls this transition
Expand All @@ -188,6 +194,12 @@ class FlipTransition extends AnimatedWidget {
/// The direction of the flip
final Axis direction;

/// {@template flip_card.FlipTransition.filterQuality}
/// The filter quality for the internal [Transform] on the card.
/// Setting this to [FilterQuality.none] can prevent vertical lines but might lead to other issues.
/// {@endtemplate}
final FilterQuality? filterQuality;

@override
Widget build(BuildContext context) {
final transform = Matrix4.identity();
Expand All @@ -204,7 +216,7 @@ class FlipTransition extends AnimatedWidget {
return Transform(
transform: transform,
alignment: FractionalOffset.center,
filterQuality: FilterQuality.none,
filterQuality: filterQuality,
child: child,
);
}
Expand Down