From ee0a6815f428918353bb42d32beb99364a6609b4 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 27 Feb 2023 21:13:26 +1100 Subject: [PATCH] Update for credits display (#274) - Cleaner display - Links are now clickable --- assets/credits.md | 9 ++------- lib/settings/release.dart | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/assets/credits.md b/assets/credits.md index 6546b187..401c3575 100644 --- a/assets/credits.md +++ b/assets/credits.md @@ -13,12 +13,7 @@ Thanks to the following contributors, for their work building this app! The InvenTree App makes use of the following third party assets -### Icons - -Icons are provided by [fontawesome](fontawesome.com) - -### Sound Files - -Sound files have been sourced from [https://www.zapsplat.com](https://www.zapsplat.com) +- Icons are provided by [fontawesome](https://fontawesome.com) +- Sound files have been sourced from [zapsplat](https://www.zapsplat.com) -------- diff --git a/lib/settings/release.dart b/lib/settings/release.dart index b04b1eb8..728a7626 100644 --- a/lib/settings/release.dart +++ b/lib/settings/release.dart @@ -1,6 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_markdown/flutter_markdown.dart"; import "package:inventree/l10.dart"; +import "package:url_launcher/url_launcher.dart"; class ReleaseNotesWidget extends StatelessWidget { @@ -30,6 +31,18 @@ class CreditsWidget extends StatelessWidget { final String credits; + /* + * Callback function when a link is clicked in the markdown + */ + Future openLink(String url) async { + + final link = Uri.parse(url); + + if (await canLaunchUrl(link)) { + await launchUrl(link); + } + } + @override Widget build (BuildContext context) { return Scaffold( @@ -38,7 +51,13 @@ class CreditsWidget extends StatelessWidget { ), body: Markdown( selectable: false, - data: credits + data: credits, + onTapLink: (url, href, title) { + var link = href ?? ""; + if (link.isNotEmpty) { + openLink(link); + } + }, ) ); }