💄 Line up attachments & expansion of link
This commit is contained in:
		| @@ -8,6 +8,7 @@ import 'package:solian/widgets/account/account_profile_popup.dart'; | ||||
| import 'package:solian/widgets/attachments/attachment_list.dart'; | ||||
| import 'package:solian/widgets/chat/chat_event_action_log.dart'; | ||||
| import 'package:solian/widgets/chat/chat_event_message.dart'; | ||||
| import 'package:solian/widgets/link_expansion.dart'; | ||||
| import 'package:timeago/timeago.dart' show format; | ||||
|  | ||||
| class ChatEvent extends StatelessWidget { | ||||
| @@ -37,6 +38,11 @@ class ChatEvent extends StatelessWidget { | ||||
|     return '$negativeSign${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds'; | ||||
|   } | ||||
|  | ||||
|   Widget _buildLinkExpansion() { | ||||
|     if (item.body['text'] == null) return const SizedBox(); | ||||
|     return LinkExpansion(content: item.body['text']); | ||||
|   } | ||||
|  | ||||
|   Widget _buildAttachment(BuildContext context, {bool isMinimal = false}) { | ||||
|     final attachments = item.body['attachments'] != null | ||||
|         ? List<String>.from(item.body['attachments']?.whereType<String>()) | ||||
| @@ -188,8 +194,9 @@ class ChatEvent extends StatelessWidget { | ||||
|                 ), | ||||
|             ], | ||||
|           ).paddingOnly(right: 12), | ||||
|           _buildAttachment(context, isMinimal: isContentPreviewing) | ||||
|               .paddingOnly(left: isContentPreviewing ? 12 : 56), | ||||
|           _buildAttachment(context, isMinimal: isContentPreviewing).paddingOnly( | ||||
|             left: isContentPreviewing ? 12 : 56, | ||||
|           ), | ||||
|         ], | ||||
|       ); | ||||
|     } else if (isQuote) { | ||||
| @@ -210,7 +217,9 @@ class ChatEvent extends StatelessWidget { | ||||
|                   Row( | ||||
|                     children: [ | ||||
|                       AccountAvatar( | ||||
|                           content: item.sender.account.avatar, radius: 9), | ||||
|                         content: item.sender.account.avatar, | ||||
|                         radius: 9, | ||||
|                       ), | ||||
|                       const SizedBox(width: 5), | ||||
|                       Text( | ||||
|                         item.sender.account.nick, | ||||
| @@ -283,6 +292,7 @@ class ChatEvent extends StatelessWidget { | ||||
|               ), | ||||
|             ], | ||||
|           ).paddingSymmetric(horizontal: 12), | ||||
|           _buildLinkExpansion().paddingOnly(left: 52), | ||||
|           _buildAttachment(context).paddingOnly(left: 56), | ||||
|         ], | ||||
|       ); | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_animate/flutter_animate.dart'; | ||||
| import 'package:get/get.dart'; | ||||
| import 'package:solian/controllers/chat_events_controller.dart'; | ||||
| import 'package:solian/models/channel.dart'; | ||||
| @@ -83,12 +82,7 @@ class ChatEventList extends StatelessWidget { | ||||
|                     ), | ||||
|                   ); | ||||
|                 }, | ||||
|               ).animate(key: Key('m-animation${item.uuid}')).slideY( | ||||
|                     duration: 250.ms, | ||||
|                     curve: Curves.fastEaseInToSlowEaseOut, | ||||
|                     end: 0, | ||||
|                     begin: 0.5, | ||||
|                   ); | ||||
|               ); | ||||
|             }, | ||||
|           ); | ||||
|         }), | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:get/get.dart'; | ||||
| import 'package:solian/models/event.dart'; | ||||
| import 'package:solian/widgets/link_expansion.dart'; | ||||
| import 'package:solian/widgets/markdown_text_content.dart'; | ||||
|  | ||||
| class ChatEventMessage extends StatelessWidget { | ||||
| @@ -54,28 +53,11 @@ class ChatEventMessage extends StatelessWidget { | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   Widget _buildLinkExpansion() { | ||||
|     final body = EventMessageBody.fromJson(item.body); | ||||
|     return LinkExpansion(content: body.text); | ||||
|   } | ||||
|  | ||||
|   Widget _buildBody(BuildContext context) { | ||||
|     if (isMerged) { | ||||
|       return Column( | ||||
|         crossAxisAlignment: CrossAxisAlignment.start, | ||||
|         children: [ | ||||
|           _buildContent(context).paddingOnly(left: 4), | ||||
|           _buildLinkExpansion(), | ||||
|         ], | ||||
|       ).paddingOnly(left: 48); | ||||
|       return _buildContent(context).paddingOnly(left: 52); | ||||
|     } else { | ||||
|       return Column( | ||||
|         crossAxisAlignment: CrossAxisAlignment.start, | ||||
|         children: [ | ||||
|           _buildContent(context), | ||||
|           _buildLinkExpansion(), | ||||
|         ], | ||||
|       ); | ||||
|       return _buildContent(context); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user