fix: consistent unpinning and unhighlight on unpin
This commit is contained in:
parent
2d23bd914c
commit
3ddc887335
2 changed files with 7 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue