feat: Implement send reactions

This commit is contained in:
Christian Pauly
2020-09-20 20:13:42 +02:00
parent 43dd22251c
commit 6bf25b709f
3 changed files with 96 additions and 7 deletions

View File

@ -2,6 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'dialogs/simple_dialogs.dart';
import 'matrix.dart';
class MessageReactions extends StatelessWidget {
@ -47,10 +48,12 @@ class MessageReactions extends StatelessWidget {
e.content['m.relates_to']['key'] == r.key,
orElse: () => null);
if (evt != null) {
evt.redact();
SimpleDialogs(context)
.tryRequestWithLoadingDialog(evt.redact());
}
} else {
event.room.sendReaction(event.eventId, r.key);
SimpleDialogs(context).tryRequestWithLoadingDialog(
event.room.sendReaction(event.eventId, r.key));
}
},
))
@ -69,8 +72,9 @@ class _Reaction extends StatelessWidget {
@override
Widget build(BuildContext context) {
final borderColor =
reacted ? Colors.red : Theme.of(context).secondaryHeaderColor;
final borderColor = reacted
? Theme.of(context).primaryColor
: Theme.of(context).secondaryHeaderColor;
final textColor = Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black;
@ -116,10 +120,10 @@ class _Reaction extends StatelessWidget {
decoration: BoxDecoration(
color: color,
border: Border.all(
width: fontSize / 20,
width: 1,
color: borderColor,
),
borderRadius: BorderRadius.all(Radius.circular(padding * 2)),
borderRadius: BorderRadius.circular(8),
),
padding: EdgeInsets.all(padding),
child: content,