Skip to content

Commit

Permalink
Add about section in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ray committed Dec 28, 2024
1 parent f42f266 commit 652ef79
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/lib/models/app.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:pikatorrent/storage/shared_preferences.dart';

class AppModel extends ChangeNotifier {
ThemeMode theme = ThemeMode.system;
bool termsOfUseAccepted = false;
bool loaded = false;
String version = '';

AppModel() {
_loadSettings();
Expand All @@ -21,6 +23,10 @@ class AppModel extends ChangeNotifier {
termsOfUseAccepted;
loaded = true;

// Load app version
PackageInfo packageInfo = await PackageInfo.fromPlatform();
version = packageInfo.version;

notifyListeners();
}

Expand Down
20 changes: 20 additions & 0 deletions app/lib/screens/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:pikatorrent/screens/settings/dialogs/theme_selector.dart';
import 'package:pikatorrent/utils/string_extensions.dart';
import 'package:provider/provider.dart';
import 'package:file_picker/file_picker.dart';
import 'package:url_launcher/url_launcher.dart';

class SettingsScreen extends StatefulWidget {
const SettingsScreen({super.key});
Expand Down Expand Up @@ -134,6 +135,25 @@ class _SettingsScreenState extends State<SettingsScreen> {
onTap: showResetTorrentsSettingsDialog,
leading: const Icon(Icons.settings_backup_restore),
title: const Text('Reset torrents settings')),
Padding(
padding: const EdgeInsets.only(left: 16.0, top: 16),
child: Text('About', style: Theme.of(context).textTheme.titleLarge),
),
ListTile(
leading: const Icon(Icons.bolt),
// onTap: () => showThemeDialog(context),
title: const Text('Version'),
subtitle: Text(app.version)),
ListTile(
leading: const Icon(Icons.discord),
title: const Text('Join our Discord'),
onTap: () => launchUrl(Uri.parse('https://discord.gg/6HxCV4aGdy'))),
ListTile(
leading: const Icon(Icons.bug_report),
title: const Text('Report a bug or feature request'),
onTap: () => launchUrl(Uri.parse(
'https://github.com/G-Ray/pikatorrent/issues/new/choose')),
),
]);
});
}
Expand Down
4 changes: 4 additions & 0 deletions app/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ import app_links
import device_info_plus
import flutter_local_notifications
import open_file_mac
import package_info_plus
import path_provider_foundation
import screen_retriever_macos
import share_plus
import shared_preferences_foundation
import url_launcher_macos
import window_manager

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}
48 changes: 48 additions & 0 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.3"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: "70c421fe9d9cc1a9a7f3b05ae56befd469fe4f8daa3b484823141a55442d858d"
url: "https://pub.dev"
source: hosted
version: "8.1.2"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b
url: "https://pub.dev"
source: hosted
version: "3.0.2"
path:
dependency: "direct main"
description:
Expand Down Expand Up @@ -894,6 +910,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
url: "https://pub.dev"
source: hosted
version: "6.3.14"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626"
url: "https://pub.dev"
source: hosted
version: "6.3.2"
url_launcher_linux:
dependency: transitive
description:
Expand All @@ -902,6 +942,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.2.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
url: "https://pub.dev"
source: hosted
version: "3.2.2"
url_launcher_platform_interface:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 0.10.0

environment:
sdk: ^3.5.3
Expand Down Expand Up @@ -62,6 +62,8 @@ dependencies:
collection: ^1.18.0
share_plus: ^10.1.3
mime: ^2.0.0
package_info_plus: ^8.1.2
url_launcher: ^6.3.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 652ef79

Please sign in to comment.