align reaction picker bubbles

This commit is contained in:
Salvatore Giordano
2020-10-29 12:49:25 +01:00
parent 8424e3a972
commit daf028d805
4 changed files with 95 additions and 82 deletions
+1
View File
@@ -96,6 +96,7 @@ class MessageActionsModal extends StatelessWidget {
showUserAvatar: showUserAvatar, showUserAvatar: showUserAvatar,
showTimestamp: false, showTimestamp: false,
translateUserAvatar: false, translateUserAvatar: false,
showReactionPickerIndicator: true,
showSendingIndicator: DisplayWidget.gone, showSendingIndicator: DisplayWidget.gone,
shape: messageShape, shape: messageShape,
), ),
+1
View File
@@ -89,6 +89,7 @@ class MessageReactionsModal extends StatelessWidget {
translateUserAvatar: false, translateUserAvatar: false,
showSendingIndicator: DisplayWidget.gone, showSendingIndicator: DisplayWidget.gone,
shape: messageShape, shape: messageShape,
showReactionPickerIndicator: true,
), ),
), ),
SizedBox( SizedBox(
+29 -2
View File
@@ -106,6 +106,9 @@ class MessageWidget extends StatefulWidget {
/// The function called when tapping on a link /// The function called when tapping on a link
final void Function(String) onLinkTap; final void Function(String) onLinkTap;
/// Used in [MessageReactionsModal] and [MessageActionsModal]
final bool showReactionPickerIndicator;
final List<Read> readList; final List<Read> readList;
/// If true show the users username next to the timestamp of the message /// If true show the users username next to the timestamp of the message
@@ -131,6 +134,7 @@ class MessageWidget extends StatefulWidget {
this.borderRadiusGeometry, this.borderRadiusGeometry,
this.attachmentBorderRadiusGeometry, this.attachmentBorderRadiusGeometry,
this.onMentionTap, this.onMentionTap,
this.showReactionPickerIndicator = false,
this.showUserAvatar = DisplayWidget.show, this.showUserAvatar = DisplayWidget.show,
this.showSendingIndicator = DisplayWidget.show, this.showSendingIndicator = DisplayWidget.show,
this.showReplyIndicator = true, this.showReplyIndicator = true,
@@ -251,7 +255,10 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
portalAnchor: Alignment(-1.0, -1.0), portalAnchor: Alignment(-1.0, -1.0),
childAnchor: Alignment(1, -1.0), childAnchor: Alignment(1, -1.0),
child: Padding( child: Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: widget.showReactions padding: widget.showReactions
? EdgeInsets.only( ? EdgeInsets.only(
top: widget.message.reactionCounts top: widget.message.reactionCounts
@@ -263,7 +270,8 @@ class _MessageWidgetState extends State<MessageWidget> {
: EdgeInsets.zero, : EdgeInsets.zero,
child: (widget.message.isDeleted && child: (widget.message.isDeleted &&
widget.message.status != widget.message.status !=
MessageSendingStatus.FAILED_DELETE) MessageSendingStatus
.FAILED_DELETE)
? Transform( ? Transform(
alignment: Alignment.center, alignment: Alignment.center,
transform: Matrix4.rotationY( transform: Matrix4.rotationY(
@@ -285,6 +293,25 @@ class _MessageWidgetState extends State<MessageWidget> {
], ],
), ),
), ),
if (widget.showReactionPickerIndicator)
Positioned(
right: 0,
top: -6,
child: Transform(
transform: Matrix4.rotationY(
widget.reverse ? pi : 0),
child: CustomPaint(
painter: ReactionBubblePainter(
widget.messageTheme
.reactionsBackgroundColor,
widget.messageTheme
.reactionsBorderColor,
),
),
),
),
],
),
), ),
), ),
], ],
+1 -17
View File
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/reaction_bubble.dart';
import '../stream_chat_flutter.dart'; import '../stream_chat_flutter.dart';
@@ -22,10 +21,7 @@ class ReactionPicker extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final reactionIcons = StreamChatTheme.of(context).reactionIcons; final reactionIcons = StreamChatTheme.of(context).reactionIcons;
return Stack( return Material(
fit: StackFit.passthrough,
children: [
Material(
color: messageTheme.reactionsBackgroundColor, color: messageTheme.reactionsBackgroundColor,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@@ -63,18 +59,6 @@ class ReactionPicker extends StatelessWidget {
); );
}).toList(), }).toList(),
), ),
),
Positioned(
right: 14,
bottom: 0,
child: CustomPaint(
painter: ReactionBubblePainter(
messageTheme.reactionsBackgroundColor,
messageTheme.reactionsBorderColor,
),
),
),
],
); );
} }