fix for long press selecting messages
This commit is contained in:
parent
ebbfba7ac9
commit
648b25a252
3 changed files with 30 additions and 16 deletions
|
|
@ -246,17 +246,13 @@ class Message extends StatelessWidget {
|
|||
onTap: () => toolbarController?.showToolbar(context),
|
||||
onDoubleTap: () =>
|
||||
toolbarController?.showToolbar(context),
|
||||
onLongPress: () {
|
||||
onSelect(event);
|
||||
HapticFeedback.selectionClick();
|
||||
},
|
||||
// onLongPress: longPressSelect
|
||||
// ? null
|
||||
// : () {
|
||||
// onSelect(event);
|
||||
// HapticFeedback.selectionClick();
|
||||
// },
|
||||
// Pangea#
|
||||
onLongPress: longPressSelect
|
||||
? null
|
||||
: () {
|
||||
onSelect(event);
|
||||
HapticFeedback.selectionClick();
|
||||
},
|
||||
child: AnimatedOpacity(
|
||||
opacity: animateIn
|
||||
? 0
|
||||
|
|
|
|||
|
|
@ -303,9 +303,19 @@ class MessageContent extends StatelessWidget {
|
|||
messageText,
|
||||
);
|
||||
return SelectableLinkify(
|
||||
onSelectionChanged: (selection, cause) => toolbarController
|
||||
?.toolbar?.textSelection
|
||||
.onTextSelection(selection),
|
||||
onSelectionChanged: (selection, cause) {
|
||||
if (cause == SelectionChangedCause.longPress &&
|
||||
toolbarController != null &&
|
||||
pangeaMessageEvent != null &&
|
||||
!(toolbarController!.highlighted)) {
|
||||
toolbarController!.controller.onSelectMessage(
|
||||
pangeaMessageEvent!.event,
|
||||
);
|
||||
return;
|
||||
}
|
||||
toolbarController?.toolbar?.textSelection
|
||||
.onTextSelection(selection);
|
||||
},
|
||||
onTap: () => toolbarController?.showToolbar(context),
|
||||
text: toolbarController?.toolbar?.textSelection.messageText ??
|
||||
messageText,
|
||||
|
|
|
|||
|
|
@ -95,9 +95,17 @@ class PangeaRichTextState extends State<PangeaRichText> {
|
|||
Widget build(BuildContext context) {
|
||||
//TODO - take out of build function of every message
|
||||
final Widget richText = SelectableText.rich(
|
||||
onSelectionChanged: (selection, cause) => widget
|
||||
.toolbarController.toolbar?.textSelection
|
||||
.onTextSelection(selection),
|
||||
onSelectionChanged: (selection, cause) {
|
||||
if (cause == SelectionChangedCause.longPress &&
|
||||
!widget.toolbarController.highlighted) {
|
||||
widget.toolbarController.controller.onSelectMessage(
|
||||
widget.pangeaMessageEvent.event,
|
||||
);
|
||||
return;
|
||||
}
|
||||
widget.toolbarController.toolbar?.textSelection
|
||||
.onTextSelection(selection);
|
||||
},
|
||||
onTap: () => widget.toolbarController.showToolbar(context),
|
||||
focusNode: widget.toolbarController.focusNode,
|
||||
contextMenuBuilder: (context, state) =>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue