Skip to content

Commit

Permalink
TW-762: add image on reply content
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE committed Nov 22, 2023
1 parent 39a3517 commit 54197e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
27 changes: 13 additions & 14 deletions lib/pages/chat/events/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -779,20 +779,19 @@ class _ReplyContent extends StatelessWidget {
BuildContext context,
snapshot,
) {
final replyEvent = snapshot.hasData
? snapshot.data!
: Event(
eventId: event.relationshipEventId!,
content: {
'msgtype': 'm.text',
'body': '...',
},
senderId: event.senderId,
type: 'm.room.message',
room: event.room,
status: EventStatus.sent,
originServerTs: DateTime.now(),
);
final replyEvent = snapshot.data ??
Event(
eventId: event.relationshipEventId!,
content: {
'msgtype': 'm.text',
'body': '...',
},
senderId: event.senderId,
type: 'm.room.message',
room: event.room,
status: EventStatus.sent,
originServerTs: DateTime.now(),
);
return InkWell(
onTap: () {
if (scrollToEventId != null) {
Expand Down
15 changes: 14 additions & 1 deletion lib/pages/chat/events/reply_content.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/events/reply_content_style.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
import 'package:fluffychat/widgets/mxc_image.dart';
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';

import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import '../../../config/app_config.dart';
import 'html_message.dart';

class ReplyContent extends StatelessWidget {
Expand Down Expand Up @@ -77,6 +78,18 @@ class ReplyContent extends StatelessWidget {
decoration: ReplyContentStyle.prefixBarDecoration(context),
),
const SizedBox(width: ReplyContentStyle.prefixAndDisplayNameSpacing),
if (displayEvent.hasAttachment)
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(4)),
child: MxcImage(
event: displayEvent,
isThumbnail: true,
width: ReplyContentStyle.fontSizeDisplayContent * 2,
height: ReplyContentStyle.fontSizeDisplayContent * 2,
fit: BoxFit.cover,
),
),
const SizedBox(width: ReplyContentStyle.prefixAndDisplayNameSpacing),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down

0 comments on commit 54197e9

Please sign in to comment.