diff --git a/flutter_hbb/lib/home_page.dart b/flutter_hbb/lib/home_page.dart index bba97dc5c..1f1a6673d 100644 --- a/flutter_hbb/lib/home_page.dart +++ b/flutter_hbb/lib/home_page.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:tuple/tuple.dart'; +import 'package:package_info/package_info.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'common.dart'; import 'model.dart'; import 'remote_page.dart'; @@ -37,11 +39,15 @@ class _HomePageState extends State { items: [ PopupMenuItem( child: Text('ID/Relay Server'), value: 'server'), + PopupMenuItem( + child: Text('About RustDesk'), value: 'about'), ], elevation: 8, ); if (value == 'server') { showServer(context); + } else if (value == 'about') { + showAbout(context); } }(); }) @@ -269,7 +275,33 @@ void showServer(BuildContext context) { child: Text('OK'), ), ], - ), + )); +} + +Future showAbout(BuildContext context) async { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + showAlertDialog( + context, + (setState) => Tuple3( + null, + Wrap(direction: Axis.vertical, spacing: 12, children: [ + Text('Version: ${packageInfo.version}'), + InkWell( + onTap: () async { + const url = 'https://forum.rustdesk.com/'; + if (await canLaunch(url)) { + await launch(url); + } + }, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 8), + child: Text('Support', + style: TextStyle( + decoration: TextDecoration.underline, + )), + )), + ]), + null), () async => true, true); } diff --git a/flutter_hbb/pubspec.lock b/flutter_hbb/pubspec.lock index 6b67cf28e..ad0879e75 100644 --- a/flutter_hbb/pubspec.lock +++ b/flutter_hbb/pubspec.lock @@ -277,6 +277,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.4" + package_info: + dependency: "direct main" + description: + name: package_info + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.3+2" path: dependency: transitive description: @@ -429,6 +436,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0-nullsafety.3" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.7.10" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+4" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+9" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.9" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5+1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+3" vector_math: dependency: transitive description: @@ -487,4 +536,4 @@ packages: version: "2.2.1" sdks: dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.20.0 <2.0.0" + flutter: ">=1.22.0 <2.0.0" diff --git a/flutter_hbb/pubspec.yaml b/flutter_hbb/pubspec.yaml index 43df138e0..25cfb59ec 100644 --- a/flutter_hbb/pubspec.yaml +++ b/flutter_hbb/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 1.1.0 environment: sdk: ">=2.7.0 <3.0.0" @@ -39,6 +39,8 @@ dependencies: wakelock: ^0.2.1+1 device_info: ^1.0.0 firebase_analytics: ^6.2.0 + package_info: ^0.4.3+2 + url_launcher: ^5.7.10 dev_dependencies: flutter_launcher_icons: "^0.8.0"