Clickable hyperlinks for MessageBubbles #235
|
@ -68,7 +68,7 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
text: widget.content + '\u202F',
|
||||
// TODO: onOpen breaks the "selectable" functionality. Maybe something to do with gesture handler?
|
||||
|
||||
options: LinkifyOptions(humanize: false),
|
||||
linkifiers: [UrlLinkifier()], // TODO: double-check on this (only web links to avoid Android messiness)
|
||||
linkifiers: [UrlLinkifier()],
|
||||
onOpen: (link) {
|
||||
_modalOpenLink(context, link);
|
||||
},
|
||||
|
@ -122,7 +122,6 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
context: ctx,
|
||||
builder: (BuildContext bcontext) {
|
||||
return Container(
|
||||
// TODO: Ask re: hard-coded height
|
||||
height: 200, // bespoke value courtesy of the [TextField] docs
|
||||
child: Center(
|
||||
NimaBoscarino
commented
I stole this modal from elsewhere in the code. Since the height has been hard-coded to 200 in several places, should I extract the modal out to be its own widget? I stole this modal from elsewhere in the code. Since the height has been hard-coded to 200 in several places, should I extract the modal out to be its own widget?
sarah
commented
I think having this widget defined here right now is fine. We have a separate task planned to go through and check widgets like (with hard coded heights etc.) I think having this widget defined here right now is fine. We have a separate task planned to go through and check widgets like (with hard coded heights etc.)
|
||||
child: Padding(
|
||||
|
@ -134,7 +133,6 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
Text(
|
||||
"Opening this link will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open links from people you trust. Are you sure you want to continue?"
|
||||
),
|
||||
// TODO: Ask about styling preferences (should this be a reusable "inline-button"?)
|
||||
Flex(direction: Axis.horizontal, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 20, horizontal: 10),
|
||||
NimaBoscarino
commented
I'm quite new to styling and layout in Flutter. Does this look okay, or are there cleaner/other ways preferred? I'm quite new to styling and layout in Flutter. Does this look okay, or are there cleaner/other ways preferred?
sarah
commented
This looks fine :) This looks fine :)
|
||||
|
@ -143,10 +141,11 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
onPressed: () {
|
||||
Clipboard.setData(new ClipboardData(text: link.url));
|
||||
|
||||
// TODO: Ask about desired SnackBar + modal behaviour
|
||||
final snackBar = SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.copiedClipboardNotification),
|
||||
);
|
||||
|
||||
Navigator.pop(bcontext);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue
For some reason, once I add the
onOpen
handler the text selection breaks (e.g. https://i.imgur.com/SrtOLIG.mp4). I don't know enough about Flutter/Dart to figure it out easily, do you know what the case might be? I tried to recreate it in a fresh sandbox but had no luck, so I'm wondering if maybe theTapGestureRecognizer
in Linkify conflicts with theMouseRegion
inmessagerow.dart
?We've definitely had a few issues with widgets interacting in these kinds of ways. I will take a look into this early next week.
I could not replicate the lack of text selection on Linux under the following Flutter Build
As such I wonder if this is platform specific (or perhaps fixed in a newer version of flutter).
I tried it with
and still ran into the issue, so it looks like it might be as macOS-specific issue!