Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Add ReorderableLists to MessageFieldView attachments (#1425)#1517

Open
IluhinDotPro wants to merge 8 commits intomainfrom
1425-implement-attachments-reordering-in-messagefieldview-by-long-tap
Open

Add ReorderableLists to MessageFieldView attachments (#1425)#1517
IluhinDotPro wants to merge 8 commits intomainfrom
1425-implement-attachments-reordering-in-messagefieldview-by-long-tap

Conversation

@IluhinDotPro
Copy link
Copy Markdown
Contributor

@IluhinDotPro IluhinDotPro commented Nov 21, 2025

Resolves #1425

Synopsis

Attachments attached cannot be sorted. Also their order is not the order that ChatMessage will display those attachments in.

Solution

  • Split attachments by to list (image/video and other files).

  • Added ReorderableList to both attachments lists

  • Modifed _addAttachment in MessageFieldController for nore correctly add new Attachment to attachments (images/video first, files than)

Checklist

  • Created PR:
    • In draft mode
    • Name contains issue reference
    • Has type and k:: labels applied
  • Before review:
    • Documentation is updated (if required)
    • Tests are updated (if required)
    • Changes conform code style
    • CHANGELOG entry is added (if required)
    • FCM (final commit message) is posted or updated
    • Draft mode is removed
  • Review is completed and changes are approved
    • FCM (final commit message) is approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • All temporary labels are removed

@IluhinDotPro IluhinDotPro self-assigned this Nov 21, 2025
@IluhinDotPro IluhinDotPro added this to the 0.7.0 milestone Nov 21, 2025
@IluhinDotPro IluhinDotPro added enhancement Improvement of existing features or bugfix k::UI/UX UI (user interface) and UX (user experience) changes k::design Changes of application architecture and implementation design k::refactor Refactor changes of existing code labels Nov 21, 2025
@IluhinDotPro
Copy link
Copy Markdown
Contributor Author

IluhinDotPro commented Nov 21, 2025

FCM

Add `ReorderableLists` to `MessageFieldView` attachments (#1517, #1425)

Additionally:
- split `attachments` in view to 2 lists (media / files)
- change add attachment logic in `_addAttachment` for correctly use media/files lists
- add `AttachmentExtension` on `Attachment`
- add UI/UX feedback when reorder was start and stop

…ments-reordering-in-messagefieldview-by-long-tap
Copy link
Copy Markdown
Contributor

@SleepySquash SleepySquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some notes. Take a look, please!

Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/view.dart Outdated
MapEntry<GlobalKey<State<StatefulWidget>>, Attachment> entry,
) {
return !_isImageOrVideo(entry);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a private extension on MapEntry<GlobalKey<State<StatefulWidget>>, Attachment> may be a cleaner thing? Let's try to stick with an extension, please?

Comment thread lib/ui/page/home/page/chat/message_field/view.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/view.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/view.dart
width:
(attachmentSize + 4) *
imgVideosAttachments.length,
child: ReorderableList(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how hard would it be to make the list auto scroll itself when reordering is out of viewport?

Screen.Recording.2025-11-24.at.10.12.26.mp4

It would be great to scroll the list horizontally when reordered item gets out of screen. How hard is it? Can you please do a quick look first in order to determine whether this would be a huge refactor, or a small refactor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the refactor will be a bit complex; some additional logic will be needed to change the sorting within a single attachment list (instead of two, as is currently the case). In that case, we'll get auto-scrolling out of the box.

@SleepySquash
Copy link
Copy Markdown
Contributor

@IluhinDotPro, and please, take a look at your FCM:

attachments (#1425) #1517

Take a look at the example FCM, please. All references must be inside the brackets. And PR first.

@SleepySquash SleepySquash removed this from Roadmap Nov 24, 2025
@SleepySquash SleepySquash modified the milestones: 0.6.11, 0.7.0 Nov 24, 2025
- format code and comments with common style
- rename `imgVideosAttachments` to `mediaAttachments`
- add `AttachmentExtension` on `Attachment`
- change `attachmentSize` to static const `_attachmentSize`
- add UI/UX feedback when reorder was start and stop
Copy link
Copy Markdown
Contributor

@SleepySquash SleepySquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't hurry, please. Before sending PR for a review, do a self-check. It's better to take an hour or more just to be extra sure that you're doing what you intended to do.

Comment thread lib/domain/extension/attachment.dart
Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/api/backend/extension/attachment.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/view.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
…1425)

- format code and comments with common style
Copy link
Copy Markdown
Contributor

@SleepySquash SleepySquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions - take a look, please

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that extension belongs to a domain, then why not integrate it directly into /domain/model/attachment.dart file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to add extensions to model files, as they might be replaced with automatic generation later, and we'll lose the code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as they might be replaced with automatic generation later

This isn't happening now, and I don't think will happen at all.

Why do you suggest writing an extension at all, if you can integrate those methods directly into the model this way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SleepySquash I agree with you.

Comment thread lib/ui/page/home/page/chat/message_field/controller.dart Outdated
Comment thread lib/ui/page/home/page/chat/message_field/view.dart Outdated
…-implement-attachments-reordering-in-messagefieldview-by-long-tap
@SleepySquash SleepySquash modified the milestones: 0.6.12, 0.7.0 Dec 1, 2025
Copy link
Copy Markdown
Contributor

@SleepySquash SleepySquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excuse me, have you seen the previous comments I've left in a review last week? #1517 (review)

All the comments are marked as "resolved", and this PR has been sent for a the review, however it seems that you neither did anything told in the comments nor wrote any arguments in those discussions as to why you don't agree with all of this.

Am I missing something? Or why did you resolve all the comments without doing or telling anything?

@SleepySquash SleepySquash modified the milestones: 0.7.1, 0.8.0, 0.7.2 Jan 7, 2026
@SleepySquash SleepySquash modified the milestones: 0.8.0, 0.9.0, 0.8.1 Jan 21, 2026
@SleepySquash SleepySquash modified the milestones: 0.8.2, 0.9.0, 0.10.0 Feb 2, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.1, 0.10.0, 0.9.2 Feb 11, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.3, 0.10.0, 0.9.4 Feb 23, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.5, 0.10.0, 0.9.6 Mar 9, 2026
@SleepySquash SleepySquash modified the milestones: 0.10.0, 0.11.0 Mar 26, 2026
@SleepySquash SleepySquash modified the milestones: 0.10.1, 0.11.0, 0.10.2 Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Improvement of existing features or bugfix k::design Changes of application architecture and implementation design k::refactor Refactor changes of existing code k::UI/UX UI (user interface) and UX (user experience) changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Attachments reordering in MessageFieldView by long tap

2 participants