fix: consistent unpinning and unhighlight on unpin

This commit is contained in:
avashilling 2025-08-01 15:13:00 -04:00
parent 2d23bd914c
commit 3ddc887335
2 changed files with 7 additions and 5 deletions

View file

@ -1184,6 +1184,11 @@ class ChatController extends State<ChatPageWithRoom>
if (response == OkCancelResult.ok) {
final events = room.pinnedEventIds
..removeWhere((oldEvent) => oldEvent == eventId);
if (scrollToEventIdMarker == eventId) {
setState(() {
scrollToEventIdMarker = null;
});
}
showFutureLoadingDialog(
context: context,
future: () => room.setPinnedEvents(events),
@ -1197,7 +1202,7 @@ class ChatController extends State<ChatPageWithRoom>
final unpin = selectedEventIds.length == 1 &&
pinnedEventIds.contains(selectedEventIds.single);
if (unpin) {
pinnedEventIds.removeWhere(selectedEventIds.contains);
unpinEvent(selectedEventIds.single);
} else {
pinnedEventIds.addAll(selectedEventIds);
}

View file

@ -293,10 +293,7 @@ class Message extends StatelessWidget {
borderRadius: BorderRadius.circular(
AppConfig.borderRadius / 2,
),
color: selected ||
(highlightMarker &&
event.room.pinnedEventIds
.contains(event.eventId))
color: selected || highlightMarker
? theme.colorScheme.secondaryContainer
.withAlpha(128)
: Colors.transparent,