fix: paint bubble

This commit is contained in:
Deven Joshi
2021-05-17 20:17:33 +05:30
parent 3dc4e9c016
commit 80bc94ba38
@@ -156,6 +156,7 @@ class ReactionBubble extends StatelessWidget {
maskColor, maskColor,
tailCirclesSpace: tailCirclesSpacing, tailCirclesSpace: tailCirclesSpacing,
flipTail: !flipTail, flipTail: !flipTail,
numberOfReactions: reactions.length,
), ),
); );
return tail; return tail;
@@ -171,6 +172,7 @@ class ReactionBubblePainter extends CustomPainter {
this.maskColor, { this.maskColor, {
this.tailCirclesSpace = 0, this.tailCirclesSpace = 0,
this.flipTail = false, this.flipTail = false,
this.numberOfReactions = 0,
}); });
/// Color of bubble /// Color of bubble
@@ -188,6 +190,9 @@ class ReactionBubblePainter extends CustomPainter {
/// Flip tail /// Flip tail
final bool flipTail; final bool flipTail;
/// Number of reactions on the page
final int numberOfReactions;
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
_drawOvalMask(size, canvas); _drawOvalMask(size, canvas);
@@ -261,7 +266,7 @@ class ReactionBubblePainter extends CustomPainter {
const dy = -2.2; const dy = -2.2;
final startAngle = flipTail ? -0.1 : 1.1; final startAngle = flipTail ? -0.1 : 1.1;
final sweepAngle = flipTail ? -1.2 : 1.2; final sweepAngle = flipTail ? -1.2 : (numberOfReactions > 1 ? 1.2 : 0.9);
final path = Path() final path = Path()
..addArc( ..addArc(
Rect.fromCircle( Rect.fromCircle(