From 3bc3e2e808a23e75d9543d8dfb0a60d3370b3b17 Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 3 Oct 2022 13:58:55 +0200 Subject: [PATCH] Set Android category as camera, add GitHub repo link and add url_launcher package --- README.md | 1 + android/app/src/main/AndroidManifest.xml | 29 ++++++++++++ lib/src/pages/settings_page.dart | 25 +++++++++-- lib/src/utils/preferences.dart | 2 +- pubspec.lock | 56 ++++++++++++++++++++++++ pubspec.yaml | 1 + 6 files changed, 110 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa3eb3c..19c98e6 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ The packages used for this app, also listed in the pubspec.yaml file. See their - [provider](https://pub.dev/packages/provider): Used for state management, specifically localization and theme support - [shared_preferences](https://pub.dev/packages/shared_preferences): Used for saving app data, including settings - [smooth_page_indicator](https://pub.dev/packages/smooth_page_indicator): Used for the page indicator in the onboarding screen +- [url_launcher](https://pub.dev/packages/url_launcher): Used for opening the GitHub repository link inside the About menu - [video_player](https://pub.dev/packages/video_player): Used for displaying a captured video inside the thumbnail # License diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9a9a25a..1cf12ad 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,6 +30,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/src/pages/settings_page.dart b/lib/src/pages/settings_page.dart index d224962..fba7c96 100644 --- a/lib/src/pages/settings_page.dart +++ b/lib/src/pages/settings_page.dart @@ -11,6 +11,7 @@ import 'package:librecamera/src/widgets/resolution.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class SettingsButton extends StatelessWidget { const SettingsButton({ @@ -165,8 +166,8 @@ class _SettingsPageState extends State { return AboutListTile( icon: const Icon(Icons.info), applicationName: 'Libre Camera', - applicationVersion: - AppLocalizations.of(context)!.version('1.0.0'), //TODO change versions + applicationVersion: AppLocalizations.of(context)!.version( + '1.0.0'), //TODO change versions HERE AND app/build.gradle 1. versionCode and 2. versionName applicationIcon: const Image( image: AssetImage('assets/images/icon.png'), width: 50, @@ -175,6 +176,24 @@ class _SettingsPageState extends State { applicationLegalese: 'GNU Public License v3', aboutBoxChildren: [ Text(AppLocalizations.of(context)!.license), + const Divider(), + TextButton.icon( + icon: const Icon(Icons.open_in_new), + onPressed: () async { + var url = Uri.parse('https://github.com/iakmds/librecamera'); + if (await canLaunchUrl(url)) { + await launchUrl(url, mode: LaunchMode.externalApplication); + } else { + throw 'Could not launch $url'; + } + }, + label: const SelectableText( + 'https://github.com/iakmds/librecamera', + style: TextStyle( + color: Colors.blue, + ), + ), + ), ], ); } @@ -240,7 +259,7 @@ class _SettingsPageState extends State { trailing: Padding( padding: const EdgeInsets.all(8.0), child: Icon( - isMoreOptions ? Icons.arrow_upward : Icons.arrow_downward, + isMoreOptions ? Icons.expand_less : Icons.expand_more, size: 35, ), ), diff --git a/lib/src/utils/preferences.dart b/lib/src/utils/preferences.dart index 75acfa8..ac86fa9 100644 --- a/lib/src/utils/preferences.dart +++ b/lib/src/utils/preferences.dart @@ -14,7 +14,7 @@ class Preferences { await _preferences!.setString(prefLanguage, locale); static String getLanguage() => _preferences!.getString(prefLanguage) ?? ''; - //Flash Mode + //Theme Mode static Future setThemeMode(String theme) async => await _preferences!.setString(prefThemeMode, theme); static String getThemeMode() => diff --git a/pubspec.lock b/pubspec.lock index 564b438..2edf9d2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -530,6 +530,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.6" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.19" + 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.1" + 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 5481bc7..800032e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: provider: ^6.0.3 shared_preferences: ^2.0.15 smooth_page_indicator: ^1.0.0+2 + url_launcher: ^6.1.6 video_player: ^2.4.7 dev_dependencies: