Enhance image link display with selectable text and open link button#683
Enhance image link display with selectable text and open link button#683mclemenceau wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
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
InlineUrlTextrendering forimageUrlwithSelectableTextplus an adjacent “open in new”IconButton. - Adds a direct
url_launcher_stringimport to open the image URL from the button.
| ), | ||
| IconButton( | ||
| icon: const Icon(Icons.open_in_new, size: 16), | ||
| onPressed: () => launchUrlString(artefact.imageUrl), |
There was a problem hiding this comment.
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).
| 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'), | |
| ), | |
| ); | |
| } | |
| } | |
| }, |
utkarsh2102
left a comment
There was a problem hiding this comment.
good catch by copilot but looks great, thank you!
rpbritton
left a comment
There was a problem hiding this comment.
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.
|
@rpbritton I will close this for now, I can revisit later if needed. Thanks again |
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
ArtefactPageInfoSectioncomponent.Instead of using the custom
InlineUrlTextwidget, 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_stringpackage 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:

Resolved issues
Documentation
N/A
Web service API changes
N/A
Tests
This PR was tested locally with a smoke test