Skip to content

Enhance image link display with selectable text and open link button#683

Closed
mclemenceau wants to merge 1 commit intomainfrom
fix-url-access
Closed

Enhance image link display with selectable text and open link button#683
mclemenceau wants to merge 1 commit intomainfrom
fix-url-access

Conversation

@mclemenceau
Copy link
Copy Markdown
Collaborator

@mclemenceau mclemenceau commented Apr 3, 2026

AI Use Disclosure: This change was authored with assistance from AI. The code was reviewed, tested locally, and validated as much as possible.

Description

This pull request updates how the artifact image link is displayed in the ArtefactPageInfoSection component.
Instead of using the custom InlineUrlText widget, the image link is now shown as selectable text with an adjacent icon button that opens the link in a browser.
Additionally, the url_launcher_string package is imported to support this functionality.

This change only matter when the artifact imageUrl is not empty and allow user to select the URL and copy it instead of download the artifact systematically.

See example:
image

Resolved issues

Documentation

N/A

Web service API changes

N/A

Tests

This PR was tested locally with a smoke test

Copilot AI review requested due to automatic review settings April 3, 2026 20:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the artefact image URL presentation in the artefact details sidebar to make the link text selectable and add an explicit “open in browser” icon action, improving usability when users need to copy the URL (issue #667).

Changes:

  • Replaces the InlineUrlText rendering for imageUrl with SelectableText plus an adjacent “open in new” IconButton.
  • Adds a direct url_launcher_string import to open the image URL from the button.

Comment thread frontend/lib/ui/artefact_page/artefact_page_info_section.dart
),
IconButton(
icon: const Icon(Icons.open_in_new, size: 16),
onPressed: () => launchUrlString(artefact.imageUrl),
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

launchUrlString(artefact.imageUrl) returns a Future (and a success/failure result). As written, any failure to open the URL will be silent and the Future is ignored. Consider making the handler async, awaiting the call, and providing user feedback (e.g., SnackBar) if it fails (or checking canLaunchUrlString).

Suggested change
onPressed: () => launchUrlString(artefact.imageUrl),
onPressed: () async {
try {
final launched = await launchUrlString(artefact.imageUrl);
if (!launched && context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Could not open image link'),
),
);
}
} catch (_) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Could not open image link'),
),
);
}
}
},

Copilot uses AI. Check for mistakes.
Comment thread frontend/lib/ui/artefact_page/artefact_page_info_section.dart
Copy link
Copy Markdown
Member

@utkarsh2102 utkarsh2102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch by copilot but looks great, thank you!

Copy link
Copy Markdown
Collaborator

@rpbritton rpbritton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of #691? It turns out there is a native Link widget to enable selecting and right-click copy, which I think results in a cleaner implementation than this.

Copy link
Copy Markdown
Collaborator

@rpbritton rpbritton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having merged #691, is this PR still necessary? Even if it is no longer necessary to have separate text and link fields, I would understand if you did want them.

I think the IconButton should be replaced with a Link based widget if possible however so the right-click copy link works.

@mclemenceau
Copy link
Copy Markdown
Collaborator Author

@rpbritton I will close this for now, I can revisit later if needed. Thanks again

@mclemenceau mclemenceau closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants