[ReactionBubble] Added Customization for the spacing between the bottom circles

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-13 16:40:28 +05:30
parent 854aea1fa2
commit 3b0c2a9a73
2 changed files with 13 additions and 11 deletions
+3 -6
View File
@@ -444,12 +444,9 @@ class _MessageWidgetState extends State<MessageWidget> {
StreamChatTheme.of(context) StreamChatTheme.of(context)
.colorTheme .colorTheme
.white, .white,
StreamChatTheme.of(context) Colors.transparent,
.colorTheme Colors.transparent,
.white, tailCirclesSpace: 1,
StreamChatTheme.of(context)
.colorTheme
.white,
), ),
), ),
), ),
+10 -5
View File
@@ -16,6 +16,7 @@ class ReactionBubble extends StatelessWidget {
this.reverse = false, this.reverse = false,
this.flipTail = false, this.flipTail = false,
this.highlightOwnReactions = true, this.highlightOwnReactions = true,
this.tailCirclesSpace = 0,
}) : super(key: key); }) : super(key: key);
final List<Reaction> reactions; final List<Reaction> reactions;
@@ -25,6 +26,7 @@ class ReactionBubble extends StatelessWidget {
final bool reverse; final bool reverse;
final bool flipTail; final bool flipTail;
final bool highlightOwnReactions; final bool highlightOwnReactions;
final double tailCirclesSpace;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -146,6 +148,7 @@ class ReactionBubble extends StatelessWidget {
backgroundColor, backgroundColor,
borderColor, borderColor,
maskColor, maskColor,
tailCirclesSpace: tailCirclesSpace,
), ),
); );
return Transform( return Transform(
@@ -160,12 +163,14 @@ class ReactionBubblePainter extends CustomPainter {
final Color color; final Color color;
final Color borderColor; final Color borderColor;
final Color maskColor; final Color maskColor;
final double tailCirclesSpace;
ReactionBubblePainter( ReactionBubblePainter(
this.color, this.color,
this.borderColor, this.borderColor,
this.maskColor, this.maskColor, {
); this.tailCirclesSpace = 0,
});
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
@@ -190,7 +195,7 @@ class ReactionBubblePainter extends CustomPainter {
final path = Path(); final path = Path();
path.addOval( path.addOval(
Rect.fromCircle( Rect.fromCircle(
center: Offset(4, 3), center: Offset(4, 3) + Offset(tailCirclesSpace, tailCirclesSpace),
radius: 4, radius: 4,
), ),
); );
@@ -206,7 +211,7 @@ class ReactionBubblePainter extends CustomPainter {
final path = Path(); final path = Path();
path.addOval( path.addOval(
Rect.fromCircle( Rect.fromCircle(
center: Offset(4, 3), center: Offset(4, 3) + Offset(tailCirclesSpace, tailCirclesSpace),
radius: 2, radius: 2,
), ),
); );
@@ -220,7 +225,7 @@ class ReactionBubblePainter extends CustomPainter {
final path = Path(); final path = Path();
path.addOval(Rect.fromCircle( path.addOval(Rect.fromCircle(
center: Offset(4, 3), center: Offset(4, 3) + Offset(tailCirclesSpace, tailCirclesSpace),
radius: 2, radius: 2,
)); ));
canvas.drawPath(path, paint); canvas.drawPath(path, paint);