diff --git a/lib/controllers/post_write_controller.dart b/lib/controllers/post_write_controller.dart index 3f1329a..4e7c472 100644 --- a/lib/controllers/post_write_controller.dart +++ b/lib/controllers/post_write_controller.dart @@ -213,11 +213,11 @@ class PostWriteController extends ChangeNotifier { aliasController.text = post.alias ?? ''; publishedAt = post.publishedAt; publishedUntil = post.publishedUntil; - visibleUsers = List.from(post.visibleUsersList ?? []); - invisibleUsers = List.from(post.invisibleUsersList ?? []); + visibleUsers = List.from(post.visibleUsersList ?? [], growable: true); + invisibleUsers = List.from(post.invisibleUsersList ?? [], growable: true); visibility = post.visibility; - tags = List.from(post.tags.map((ele) => ele.alias)); - categories = List.from(post.categories.map((ele) => ele.alias)); + tags = List.from(post.tags.map((ele) => ele.alias), growable: true); + categories = List.from(post.categories.map((ele) => ele.alias), growable: true); attachments.addAll(post.preload?.attachments?.map((ele) => PostWriteMedia(ele)) ?? []); if (post.preload?.thumbnail != null && (post.preload?.thumbnail?.rid.isNotEmpty ?? false)) { @@ -344,9 +344,10 @@ class PostWriteController extends ChangeNotifier { if (titleController.text.isNotEmpty) 'title': titleController.text, if (descriptionController.text.isNotEmpty) 'description': descriptionController.text, if (thumbnail != null && thumbnail!.attachment != null) 'thumbnail': thumbnail!.attachment!.toJson(), - 'attachments': attachments.where((e) => e.attachment != null).map((e) => e.attachment!.toJson()).toList(), - 'tags': tags.map((ele) => {'alias': ele}).toList(), - 'categories': categories.map((ele) => {'alias': ele}).toList(), + 'attachments': + attachments.where((e) => e.attachment != null).map((e) => e.attachment!.toJson()).toList(growable: true), + 'tags': tags.map((ele) => {'alias': ele}).toList(growable: true), + 'categories': categories.map((ele) => {'alias': ele}).toList(growable: true), 'visibility': visibility, 'visible_users_list': visibleUsers, 'invisible_users_list': invisibleUsers, diff --git a/lib/screens/post/post_editor.dart b/lib/screens/post/post_editor.dart index 1474693..47e2770 100644 --- a/lib/screens/post/post_editor.dart +++ b/lib/screens/post/post_editor.dart @@ -365,30 +365,31 @@ class _PostEditorScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: const EdgeInsets.only(top: 4, bottom: 4, left: 28, right: 22), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 1 / MediaQuery.of(context).devicePixelRatio, - ), - ), - ), child: _writeController.temporaryRestored - ? Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Icon(Icons.restore, size: 20), - const Gap(8), - Expanded(child: Text('postLocalDraftRestored').tr()), - InkWell( - child: Text('dialogDismiss').tr(), - onTap: () { - _writeController.reset(); - }, + ? Container( + padding: const EdgeInsets.only(top: 4, bottom: 4, left: 28, right: 22), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 1 / MediaQuery.of(context).devicePixelRatio, + ), ), - ], - ) + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Icon(Icons.restore, size: 20), + const Gap(8), + Expanded(child: Text('postLocalDraftRestored').tr()), + InkWell( + child: Text('dialogDismiss').tr(), + onTap: () { + _writeController.reset(); + }, + ), + ], + )) : const SizedBox.shrink(), ) .height(_writeController.temporaryRestored ? 32 : 0, animate: true) diff --git a/lib/widgets/chat/chat_message.dart b/lib/widgets/chat/chat_message.dart index 5f2c0f9..93684e6 100644 --- a/lib/widgets/chat/chat_message.dart +++ b/lib/widgets/chat/chat_message.dart @@ -53,7 +53,7 @@ class ChatMessage extends StatelessWidget { iconOnRightSwipe: Symbols.edit, swipeSensitivity: 20, onLeftSwipe: onReply != null ? (_) => onReply!(data) : null, - onRightSwipe: onEdit != null ? (_) => onEdit!(data) : null, + onRightSwipe: (onEdit != null && isOwner) ? (_) => onEdit!(data) : null, child: ContextMenuArea( contextMenu: ContextMenu( entries: [ @@ -103,8 +103,7 @@ class ChatMessage extends StatelessWidget { children: [ if (!isMerged) Row( - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, + crossAxisAlignment: CrossAxisAlignment.center, children: [ if (isCompact) AccountImage( @@ -153,7 +152,7 @@ class ChatMessage extends StatelessWidget { ) ], ).opacity(isPending ? 0.5 : 1), - if (data.body['text'] != null && (data.body['text']?.isNotEmpty ?? false)) + if (data.body['text'] != null && data.type == 'messages.new' && (data.body['text']?.isNotEmpty ?? false)) LinkPreviewWidget(text: data.body['text']!), if (data.preload?.attachments?.isNotEmpty ?? false) AttachmentList( @@ -161,7 +160,8 @@ class ChatMessage extends StatelessWidget { bordered: true, gridded: true, noGrow: true, - maxHeight: 520, + maxHeight: 560, + minWidth: 480, padding: const EdgeInsets.only(top: 8), ), if (!hasMerged && !isCompact) const Gap(12) else if (!isCompact) const Gap(6),