Skip to content

Commit

Permalink
chore: test size transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Jan 10, 2025
1 parent e3a6d30 commit 4220965
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 79 deletions.
4 changes: 2 additions & 2 deletions lib/chat/view/chat_room/chat_timeline_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class _ChatTimelineListState extends State<ChatTimelineList> {
index: i,
controller: _controller,
key: ValueKey('${event.eventId}tag'),
child: FadeTransition(
opacity: animation,
child: SizeTransition(
sizeFactor: animation,
child: ChatEventColumn(
key: ValueKey('${event.eventId}column'),
event: event,
Expand Down
162 changes: 85 additions & 77 deletions lib/chat/view/events/chat_message_bubble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,91 +136,99 @@ class _ChatMessageBubbleContent extends StatelessWidget {
final messageStyle = textTheme.bodyMedium;
final displayEvent = event.getDisplayEvent(timeline);

return Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
spacing: kSmallPadding,
children: [
Padding(
padding: const EdgeInsets.all(kSmallPadding),
child: hideAvatar || event.messageType == MessageTypes.BadEncrypted
? const SizedBox.shrink()
: event.messageType == MessageTypes.Text
? ChatAvatar(
avatarUri: event.senderFromMemoryOrFallback.avatarUrl,
onTap: () => showDialog(
context: context,
builder: (context) =>
ChatProfileDialog(userId: event.senderId),
),
fallBackColor: getMonochromeBg(
theme: context.theme,
factor: 10,
darkFactor: yaru ? 1 : null,
),
)
: ChatMessageMediaAvatar(event: event),
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: kSmallPadding,
final hide = hideAvatar && event.messageType == MessageTypes.Text;

final Widget chatBubbleAvatar;
if (hide) {
chatBubbleAvatar = const SizedBox.shrink();
} else {
chatBubbleAvatar = event.messageType == MessageTypes.Text
? ChatAvatar(
avatarUri: event.senderFromMemoryOrFallback.avatarUrl,
onTap: () => showDialog(
context: context,
builder: (context) => ChatProfileDialog(userId: event.senderId),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Text(
event.senderFromMemoryOrFallback.calcDisplayname(),
style: textTheme.labelSmall,
),
),
if (!event.redacted)
fallBackColor: getMonochromeBg(
theme: context.theme,
factor: 10,
darkFactor: yaru ? 1 : null,
),
)
: ChatMessageMediaAvatar(event: event);
}
return Material(
color: Colors.transparent,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
spacing: kSmallPadding,
children: [
Padding(
padding: const EdgeInsets.all(kSmallPadding),
child: chatBubbleAvatar,
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: kSmallPadding,
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: ChatMessageReplyHeader(
event: event,
timeline: timeline,
onReplyOriginClick: onReplyOriginClick,
child: Text(
event.senderFromMemoryOrFallback.calcDisplayname(),
style: textTheme.labelSmall,
),
),
],
),
Opacity(
opacity: event.redacted ? 0.5 : 1,
child: event.redacted
? LocalizedDisplayEventText(
displayEvent: displayEvent,
style: messageStyle?.copyWith(
decoration: TextDecoration.lineThrough,
if (!event.redacted)
Flexible(
child: ChatMessageReplyHeader(
event: event,
timeline: timeline,
onReplyOriginClick: onReplyOriginClick,
),
)
: event.isRichMessage
? HtmlMessage(
html: html,
room: timeline.room,
defaultTextColor: context.colorScheme.onSurface,
)
: SelectableText.rich(
TextSpan(
),
],
),
Opacity(
opacity: event.redacted ? 0.5 : 1,
child: event.redacted
? LocalizedDisplayEventText(
displayEvent: displayEvent,
style: messageStyle?.copyWith(
decoration: TextDecoration.lineThrough,
),
)
: event.isRichMessage
? HtmlMessage(
html: html,
room: timeline.room,
defaultTextColor: context.colorScheme.onSurface,
)
: SelectableText.rich(
TextSpan(
style: messageStyle,
text: displayEvent.body,
),
style: messageStyle,
text: displayEvent.body,
),
style: messageStyle,
),
),
const SizedBox(
height: kBigPadding,
),
],
),
const SizedBox(
height: kBigPadding,
),
],
),
),
),
const SizedBox(
height: kSmallPadding,
),
],
const SizedBox(
height: kSmallPadding,
),
],
),
);
}
}

0 comments on commit 4220965

Please sign in to comment.