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
🐞 Fixed
- Show message custom actions on desktop context menu.
- Can move cursor by left/right arrow in StreamMessageInput on web/desktop.
✅ Added
- `VideoAttachment` now uses `thumbUrl` to show the thumbnail
@@ -35,10 +35,11 @@ class KeyboardShortcutRunner extends StatelessWidget {
return FocusableActionDetector(
autofocus: true,
shortcuts: {
enterKeySet: EnterKeyIntent(),
escapeKeySet: EscapeKeyIntent(),
rightArrowKeySet: RightArrowKeyIntent(),
leftArrowKeySet: LeftArrowKeyIntent(),
if (onEnterKeypress != null) enterKeySet: EnterKeyIntent(),
if (onEscapeKeypress != null) escapeKeySet: EscapeKeyIntent(),
if (onRightArrowKeypress != null)
rightArrowKeySet: RightArrowKeyIntent(),
if (onLeftArrowKeypress != null) leftArrowKeySet: LeftArrowKeyIntent(),
},
actions: {
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),
))
];
}