add swipe to reply

Fixes #90
This commit is contained in:
Henry Hiles 2026-10-16 18:08:42 -04:00
commit 2f17f5b6c6
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
6 changed files with 116 additions and 17 deletions

View file

@ -29,6 +29,7 @@ import "package:nexus/widgets/renderers/message.dart";
import "package:nexus/widgets/reaction_row.dart";
import "package:nexus/widgets/renderers/membership.dart";
import "package:nexus/widgets/renderers/generic_event.dart";
import "package:nexus/widgets/swipe_to_reply.dart";
import "package:nexus/widgets/timestamp.dart";
class const EventRenderer(
@ -39,6 +40,9 @@ class const EventRenderer(
final int? maxLines,
final JumpToEvent? jumpToEvent,
final IList<PopupMenuEntry> Function(Event event)? getEventOptions,
/// If set, events can be swiped, calling this
final VoidCallback? onSwipe,
super.key,
}) extends HookConsumerWidget {
@override
@ -239,18 +243,21 @@ class const EventRenderer(
child: GestureDetector(
onSecondaryTapUp: contextMenuCallback,
onLongPressStart: contextMenuCallback,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8)
.copyWith(top: isGrouped ? 0 : 8),
child: Wrap(
verticalDirection: .up,
spacing: 6,
crossAxisAlignment: .center,
children: [
child,
if (child is! MessageRenderer)
Timestamp(event.timestamp),
],
child: SwipeToReply(
onSwipe: onSwipe,
Padding(
padding: EdgeInsets.symmetric(horizontal: 8)
.copyWith(top: isGrouped ? 0 : 8),
child: Wrap(
verticalDirection: .up,
spacing: 6,
crossAxisAlignment: .center,
children: [
child,
if (child is! MessageRenderer)
Timestamp(event.timestamp),
],
),
),
),
),