Skip to content

Commit

Permalink
dont show time seperator on single event
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz committed Jun 5, 2024
1 parent 8fe9342 commit f7233dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TimelineEventMenuDialog extends StatelessWidget {
child: SizedBox(
child: TimelineViewEntry(
timeline: timeline,
overrideShowSender: true,
singleEvent: true,
initialIndex: timeline.events.indexOf(event),
showDetailed: true,
),
Expand Down
12 changes: 9 additions & 3 deletions commet/lib/ui/molecules/timeline_events/timeline_view_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ class TimelineViewEntry extends StatefulWidget {
this.setEditingEvent,
this.setReplyingEvent,
this.showDetailed = false,
this.overrideShowSender = false,
this.singleEvent = false,
super.key});
final Timeline timeline;
final int initialIndex;
final Function(String eventId)? onEventHovered;
final Function(TimelineEvent? event)? setReplyingEvent;
final Function(TimelineEvent? event)? setEditingEvent;
final bool showDetailed;
final bool overrideShowSender;

// Should be true if we are showing this event on its own, and not as part of a timeline
final bool singleEvent;

@override
State<TimelineViewEntry> createState() => TimelineViewEntryState();
Expand Down Expand Up @@ -68,6 +70,10 @@ class TimelineViewEntryState extends State<TimelineViewEntry>
}

bool shouldEventShowDate(int index) {
if (widget.singleEvent) {
return false;
}

var offsetIndex = index + 1;

if (widget.timeline.events.length <= offsetIndex) {
Expand Down Expand Up @@ -193,7 +199,7 @@ class TimelineViewEntryState extends State<TimelineViewEntry>
key: eventKey,
timeline: widget.timeline,
detailed: widget.showDetailed || selected,
overrideShowSender: widget.overrideShowSender,
overrideShowSender: widget.singleEvent,
initialIndex: widget.initialIndex);
case EventType.roomCreated:
case EventType.memberJoined:
Expand Down

0 comments on commit f7233dc

Please sign in to comment.