put own reaction to the right

This commit is contained in:
Salvatore Giordano
2020-10-27 16:56:51 +01:00
parent e8411d3aa4
commit e9572d48b9
3 changed files with 129 additions and 136 deletions
+9 -13
View File
@@ -43,14 +43,16 @@ class MessageActionsModal extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
Positioned.fill(
child: GestureDetector(
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
Navigator.pop(context);
},
child: SingleChildScrollView(
padding: const EdgeInsets.only(top: 160),
child: Stack(
children: [
Positioned.fill(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10,
@@ -61,7 +63,6 @@ class MessageActionsModal extends StatelessWidget {
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Column(
@@ -85,9 +86,6 @@ class MessageActionsModal extends StatelessWidget {
text: message.text.length > 200
? '${message.text.substring(0, 200)}...'
: message.text,
attachments: message.attachments.length > 1
? [message.attachments[0]]
: message.attachments,
),
messageTheme: messageTheme,
showReactions: false,
@@ -101,8 +99,7 @@ class MessageActionsModal extends StatelessWidget {
SizedBox(
height: 8,
),
Flexible(
child: Padding(
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 48.0,
),
@@ -111,7 +108,6 @@ class MessageActionsModal extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: ListTile.divideTiles(
@@ -129,13 +125,13 @@ class MessageActionsModal extends StatelessWidget {
).toList(),
),
),
),
),
)
],
),
),
],
),
),
);
}
+9 -14
View File
@@ -34,14 +34,16 @@ class MessageReactionsModal extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
Positioned.fill(
child: GestureDetector(
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
Navigator.pop(context);
},
child: SingleChildScrollView(
padding: const EdgeInsets.only(top: 160),
child: Stack(
children: [
Positioned.fill(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10,
@@ -52,7 +54,6 @@ class MessageReactionsModal extends StatelessWidget {
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Column(
@@ -76,9 +77,6 @@ class MessageReactionsModal extends StatelessWidget {
text: message.text.length > 200
? '${message.text.substring(0, 200)}...'
: message.text,
attachments: message.attachments.length > 1
? [message.attachments[0]]
: message.attachments,
),
messageTheme: messageTheme,
showReactions: false,
@@ -93,16 +91,13 @@ class MessageReactionsModal extends StatelessWidget {
height: 16,
),
if (message.latestReactions?.isNotEmpty == true)
Flexible(
child: Container(
constraints: BoxConstraints.loose(Size.fromHeight(400)),
child: _buildReactionCard(context),
),
),
_buildReactionCard(context),
],
),
),
],
),
),
);
}
+3 -1
View File
@@ -392,6 +392,8 @@ class _MessageWidgetState extends State<MessageWidget> {
reactionsMap[element.type] = element;
}
});
final reactionsList = reactionsMap.values.toList()
..sort((a, b) => a.user.id == ownId ? 1 : -1);
return AnimatedSwitcher(
duration: Duration(milliseconds: 300),
@@ -406,7 +408,7 @@ class _MessageWidgetState extends State<MessageWidget> {
flipTail: widget.reverse,
backgroundColor: widget.messageTheme.reactionsBackgroundColor,
borderColor: widget.messageTheme.reactionsBorderColor,
reactions: reactionsMap.values.toList(),
reactions: reactionsList,
),
)
: SizedBox(),