feat(ui): show custom action on context menu (#1353)

* fix(ui): Show message custom actions on desktop context menu.

* fix(ui): don't handle keyboard shortcut when callback is null.

Co-authored-by: Salvatore Giordano <[email protected]>
This commit is contained in:
lightrabbit
2022-10-24 11:28:28 +02:00
committed by GitHub
co-authored by Salvatore Giordano
parent 1e9e942c46
commit 9369defe11
3 changed files with 15 additions and 4 deletions
@@ -1,5 +1,10 @@
## Upcoming ## Upcoming
🐞 Fixed
- Show message custom actions on desktop context menu.
- Can move cursor by left/right arrow in StreamMessageInput on web/desktop.
✅ Added ✅ Added
- `VideoAttachment` now uses `thumbUrl` to show the thumbnail - `VideoAttachment` now uses `thumbUrl` to show the thumbnail
@@ -35,10 +35,11 @@ class KeyboardShortcutRunner extends StatelessWidget {
return FocusableActionDetector( return FocusableActionDetector(
autofocus: true, autofocus: true,
shortcuts: { shortcuts: {
enterKeySet: EnterKeyIntent(), if (onEnterKeypress != null) enterKeySet: EnterKeyIntent(),
escapeKeySet: EscapeKeyIntent(), if (onEscapeKeypress != null) escapeKeySet: EscapeKeyIntent(),
rightArrowKeySet: RightArrowKeyIntent(), if (onRightArrowKeypress != null)
leftArrowKeySet: LeftArrowKeyIntent(), rightArrowKeySet: RightArrowKeyIntent(),
if (onLeftArrowKeypress != null) leftArrowKeySet: LeftArrowKeyIntent(),
}, },
actions: { actions: {
EnterKeyIntent: CallbackAction( EnterKeyIntent: CallbackAction(
@@ -1033,6 +1033,11 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
} }
}, },
), ),
...widget.customActions.map((e) => StreamChatContextMenuItem(
leading: e.leading,
title: e.title,
onClick: () => e.onTap?.call(widget.message),
))
]; ];
} }