Created
September 4, 2021 21:02
-
-
Save diegoveloper/f609352bd03517022abcb742840a80ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class FavoriteCircle extends StatelessWidget { | |
const FavoriteCircle({ | |
Key key, | |
@required this.size, | |
@required this.percent, | |
}) : super(key: key); | |
final Size size; | |
final double percent; | |
@override | |
Widget build(BuildContext context) { | |
return Positioned( | |
bottom: size.height * 0.10, | |
right: 10, | |
child: percent < 0.2 | |
? TweenAnimationBuilder<double>( | |
tween: percent < 0.17 | |
? Tween(begin: 1, end: 0) | |
: Tween(begin: 0, end: 1), | |
duration: const Duration(milliseconds: 300), | |
builder: (context, value, widget) { | |
return Transform.scale( | |
scale: 1.0 - value, | |
child: CircleAvatar( | |
minRadius: 20, | |
backgroundColor: Colors.red[300], | |
child: Icon( | |
Icons.favorite, | |
color: Colors.red[900], | |
), | |
), | |
); | |
}) | |
: Container(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment