|
|
|
@ -144,11 +144,14 @@ class Message extends StatelessWidget {
|
|
|
|
|
setState(resetAnimateIn);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return AnimatedSlide(
|
|
|
|
|
offset: Offset(0, animateIn ? 1 : 0),
|
|
|
|
|
return AnimatedSize(
|
|
|
|
|
duration: FluffyThemes.animationDuration,
|
|
|
|
|
curve: FluffyThemes.animationCurve,
|
|
|
|
|
child: Stack(
|
|
|
|
|
clipBehavior: Clip.none,
|
|
|
|
|
alignment: ownMessage ? Alignment.bottomRight : Alignment.bottomLeft,
|
|
|
|
|
child: animateIn
|
|
|
|
|
? const SizedBox(height: 0, width: double.infinity)
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
@ -201,7 +204,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
child: event.status == EventStatus.error
|
|
|
|
|
? const Icon(Icons.error, color: Colors.red)
|
|
|
|
|
: event.fileSendingStatus != null
|
|
|
|
|
? const CircularProgressIndicator.adaptive(
|
|
|
|
|
? const CircularProgressIndicator
|
|
|
|
|
.adaptive(
|
|
|
|
|
strokeWidth: 1,
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
@ -212,8 +216,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
FutureBuilder<User?>(
|
|
|
|
|
future: event.fetchSenderUser(),
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
final user =
|
|
|
|
|
snapshot.data ?? event.senderFromMemoryOrFallback;
|
|
|
|
|
final user = snapshot.data ??
|
|
|
|
|
event.senderFromMemoryOrFallback;
|
|
|
|
|
return Avatar(
|
|
|
|
|
mxContent: user.avatarUrl,
|
|
|
|
|
name: user.calcDisplayname(),
|
|
|
|
@ -231,26 +235,29 @@ class Message extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
if (!nextEventSameSender)
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(left: 8.0, bottom: 4),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 8.0,
|
|
|
|
|
bottom: 4,
|
|
|
|
|
),
|
|
|
|
|
child: ownMessage || event.room.isDirectChat
|
|
|
|
|
? const SizedBox(height: 12)
|
|
|
|
|
: FutureBuilder<User?>(
|
|
|
|
|
future: event.fetchSenderUser(),
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
final displayname =
|
|
|
|
|
snapshot.data?.calcDisplayname() ??
|
|
|
|
|
final displayname = snapshot.data
|
|
|
|
|
?.calcDisplayname() ??
|
|
|
|
|
event.senderFromMemoryOrFallback
|
|
|
|
|
.calcDisplayname();
|
|
|
|
|
return Text(
|
|
|
|
|
displayname,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color:
|
|
|
|
|
(Theme.of(context).brightness ==
|
|
|
|
|
color: (Theme.of(context)
|
|
|
|
|
.brightness ==
|
|
|
|
|
Brightness.light
|
|
|
|
|
? displayname.color
|
|
|
|
|
: displayname.lightColorText),
|
|
|
|
|
: displayname
|
|
|
|
|
.lightColorText),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
@ -278,7 +285,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
duration: FluffyThemes.animationDuration,
|
|
|
|
|
curve: FluffyThemes.animationCurve,
|
|
|
|
|
child: Material(
|
|
|
|
|
color: noBubble ? Colors.transparent : color,
|
|
|
|
|
color:
|
|
|
|
|
noBubble ? Colors.transparent : color,
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: borderRadius,
|
|
|
|
@ -296,7 +304,8 @@ class Message extends StatelessWidget {
|
|
|
|
|
vertical: 8,
|
|
|
|
|
),
|
|
|
|
|
constraints: const BoxConstraints(
|
|
|
|
|
maxWidth: FluffyThemes.columnWidth * 1.5,
|
|
|
|
|
maxWidth:
|
|
|
|
|
FluffyThemes.columnWidth * 1.5,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
@ -306,10 +315,14 @@ class Message extends StatelessWidget {
|
|
|
|
|
if (event.relationshipType ==
|
|
|
|
|
RelationshipTypes.reply)
|
|
|
|
|
FutureBuilder<Event?>(
|
|
|
|
|
future: event.getReplyEvent(timeline),
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, snapshot) {
|
|
|
|
|
final replyEvent = snapshot.hasData
|
|
|
|
|
future: event
|
|
|
|
|
.getReplyEvent(timeline),
|
|
|
|
|
builder: (
|
|
|
|
|
BuildContext context,
|
|
|
|
|
snapshot,
|
|
|
|
|
) {
|
|
|
|
|
final replyEvent = snapshot
|
|
|
|
|
.hasData
|
|
|
|
|
? snapshot.data!
|
|
|
|
|
: Event(
|
|
|
|
|
eventId: event
|
|
|
|
@ -318,27 +331,33 @@ class Message extends StatelessWidget {
|
|
|
|
|
'msgtype': 'm.text',
|
|
|
|
|
'body': '...',
|
|
|
|
|
},
|
|
|
|
|
senderId: event.senderId,
|
|
|
|
|
type: 'm.room.message',
|
|
|
|
|
senderId:
|
|
|
|
|
event.senderId,
|
|
|
|
|
type:
|
|
|
|
|
'm.room.message',
|
|
|
|
|
room: event.room,
|
|
|
|
|
status: EventStatus.sent,
|
|
|
|
|
status:
|
|
|
|
|
EventStatus.sent,
|
|
|
|
|
originServerTs:
|
|
|
|
|
DateTime.now(),
|
|
|
|
|
);
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(
|
|
|
|
|
bottom: 4.0,
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
borderRadius:
|
|
|
|
|
ReplyContent.borderRadius,
|
|
|
|
|
onTap: () => scrollToEventId(
|
|
|
|
|
borderRadius: ReplyContent
|
|
|
|
|
.borderRadius,
|
|
|
|
|
onTap: () =>
|
|
|
|
|
scrollToEventId(
|
|
|
|
|
replyEvent.eventId,
|
|
|
|
|
),
|
|
|
|
|
child: AbsorbPointer(
|
|
|
|
|
child: ReplyContent(
|
|
|
|
|
replyEvent,
|
|
|
|
|
ownMessage: ownMessage,
|
|
|
|
|
ownMessage:
|
|
|
|
|
ownMessage,
|
|
|
|
|
timeline: timeline,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -361,18 +380,20 @@ class Message extends StatelessWidget {
|
|
|
|
|
top: 4.0,
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisSize:
|
|
|
|
|
MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.edit_outlined,
|
|
|
|
|
color: textColor.withAlpha(164),
|
|
|
|
|
color: textColor
|
|
|
|
|
.withAlpha(164),
|
|
|
|
|
size: 14,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color:
|
|
|
|
|
textColor.withAlpha(164),
|
|
|
|
|
color: textColor
|
|
|
|
|
.withAlpha(164),
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|