diff --git a/CHANGELOG.md b/CHANGELOG.md index ee78081..8a0d3e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Fixed - an issue in which level 1 did not unlock (Workaround for version 1.1.2: Solve the very first question again or change the theme.) +- the website URL is now clickable ## [1.1.2] - 2022-07-22 ### Added diff --git a/lib/main.dart b/lib/main.dart index be43280..d357d04 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,6 +12,8 @@ import 'package:sqflite/sqflite.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:everest/game.dart'; import 'package:flex_color_scheme/flex_color_scheme.dart'; +import 'package:url_launcher/link.dart'; +import 'package:url_launcher/url_launcher.dart'; const appName = 'Everest'; const String themeModeKey = 'settings:themeMode'; @@ -382,13 +384,38 @@ class ThemeModeLabel extends StatelessWidget { } } +class MoreInfoMessage extends StatelessWidget { + const MoreInfoMessage({Key? key}) : super(key: key); + @override + Widget build(BuildContext context) { + final ThemeData theme = Theme.of(context); + final TextStyle textStyle = theme.textTheme.bodyText2!; + final Uri url = Uri.parse('https://mwageringel.github.io/everest/'); + return Text.rich( // important for vertical alignment + TextSpan( + children: [ + TextSpan(style: textStyle, text: AppLocalizations.of(context)!.moreInfo), + WidgetSpan( + child: Link( + uri: url, + builder: (context, followLink) => InkWell( + // opens new tab in web (in contrast to `followLink`) and external browser on android + onTap: () => launchUrl(url, mode: LaunchMode.externalApplication), + child: Text(url.toString(), style: textStyle.copyWith(color: theme.colorScheme.primary)), + ), + ), + ), + ], + ), + ); + } +} + class SettingsScreen extends StatelessWidget { const SettingsScreen({ Key? key }) : super(key: key); @override Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); - final TextStyle textStyle = theme.textTheme.bodyText2!; return ListView( padding: listPadding, children: [ @@ -438,18 +465,8 @@ class SettingsScreen extends StatelessWidget { AboutListTile( icon: const Icon(Icons.info_outline), applicationVersion: "${AppLocalizations.of(context)!.version} ${Provider.of(context).appInfo.version}", - aboutBoxChildren: [ - SelectableText.rich( - TextSpan( - children: [ - TextSpan(style: textStyle, text: AppLocalizations.of(context)!.moreInfo), - TextSpan( - style: textStyle.copyWith(color: theme.colorScheme.primary), - text: 'https://mwageringel.github.io/everest/'), // TODO make hyperlink clickable or copy to clipboard - TextSpan(style: textStyle, text: '.'), - ], - ), - ), + aboutBoxChildren: const [ + MoreInfoMessage(), ], ), const MyDivider(), diff --git a/pubspec.lock b/pubspec.lock index df6892b..ac17f23 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -495,6 +495,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.5" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9a3be18..07822d9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,7 @@ dependencies: provider: ^6.0.2 package_info_plus: ^1.4.2 flex_color_scheme: ^5.1.0 + url_launcher: ^6.1.5 # scrollable_positioned_list: ^0.2.3 dev_dependencies: