Merge branch 'flutter_desktop' of https://github.com/rustdesk/rustdesk into option_multi_instances

This commit is contained in:
csf 2022-05-31 20:25:31 +08:00
commit 5fb89c98e4
7 changed files with 413 additions and 109 deletions

5
Cargo.lock generated
View File

@ -1476,9 +1476,8 @@ dependencies = [
[[package]] [[package]]
name = "flutter_rust_bridge_codegen" name = "flutter_rust_bridge_codegen"
version = "1.30.0" version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge#827fc60143988dfc3759f7e8ce16a20d80edd710"
checksum = "3209735fd687b06b8d770ec008874119b91f7f46b4a73d17226d5c337435bb74"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_metadata", "cargo_metadata",

View File

@ -119,7 +119,7 @@ winapi = { version = "0.3", features = [ "winnt" ] }
[build-dependencies] [build-dependencies]
cc = "1.0" cc = "1.0"
hbb_common = { path = "libs/hbb_common" } hbb_common = { path = "libs/hbb_common" }
flutter_rust_bridge_codegen = "1.30.0" flutter_rust_bridge_codegen = { git = "https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge" }
[dev-dependencies] [dev-dependencies]
hound = "3.4" hound = "3.4"

1
flutter/.gitignore vendored
View File

@ -45,6 +45,7 @@ jniLibs
# flutter rust bridge # flutter rust bridge
lib/generated_bridge.dart lib/generated_bridge.dart
lib/generated_bridge.freezed.dart
# Flutter Generated Files # Flutter Generated Files
linux/flutter/generated_plugin_registrant.cc linux/flutter/generated_plugin_registrant.cc

View File

@ -53,6 +53,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
children: <Widget>[ children: <Widget>[
getUpdateUI(), getUpdateUI(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
getSearchBarUI(), getSearchBarUI(),
], ],

View File

@ -1,8 +1,9 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/desktop/pages/remote_page.dart'; import 'package:flutter_hbb/desktop/pages/remote_page.dart';
import 'package:flutter_hbb/models/model.dart'; import 'package:flutter_hbb/desktop/widgets/titlebar_widget.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart'; import 'package:flutter_hbb/utils/multi_window_manager.dart';
class ConnectionTabPage extends StatefulWidget { class ConnectionTabPage extends StatefulWidget {
@ -18,11 +19,13 @@ class _ConnectionTabPageState extends State<ConnectionTabPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
// refactor List<int> when using multi-tab // refactor List<int> when using multi-tab
// this singleton is only for test // this singleton is only for test
late String connectionId; List<String> connectionIds = List.empty(growable: true);
late TabController tabController; var initialIndex = 0;
_ConnectionTabPageState(Map<String, dynamic> params) { _ConnectionTabPageState(Map<String, dynamic> params) {
connectionId = params['id'] ?? ""; if (params['id'] != null) {
connectionIds.add(params['id']);
}
} }
@override @override
@ -34,33 +37,88 @@ class _ConnectionTabPageState extends State<ConnectionTabPage>
// for simplify, just replace connectionId // for simplify, just replace connectionId
if (call.method == "new_remote_desktop") { if (call.method == "new_remote_desktop") {
setState(() { setState(() {
FFI.close(); final args = jsonDecode(call.arguments);
connectionId = jsonDecode(call.arguments)["id"]; final id = args['id'];
final indexOf = connectionIds.indexOf(id);
if (indexOf >= 0) {
setState(() {
initialIndex = indexOf;
});
} else {
connectionIds.add(id);
setState(() {
initialIndex = connectionIds.length - 1;
});
}
}); });
} }
}); });
tabController = TabController(length: 1, vsync: this);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Scaffold(
children: [ body: DefaultTabController(
TabBar( initialIndex: initialIndex,
controller: tabController, length: connectionIds.length,
isScrollable: true, animationDuration: Duration.zero,
labelColor: Colors.black87, child: Column(
physics: NeverScrollableScrollPhysics(), children: [
tabs: [ SizedBox(
Tab( height: 50,
text: connectionId, child: DesktopTitleBar(
child: TabBar(
isScrollable: true,
labelColor: Colors.white,
physics: NeverScrollableScrollPhysics(),
indicatorColor: Colors.white,
tabs: connectionIds
.map((e) => Tab(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(e),
SizedBox(
width: 4,
),
InkWell(
onTap: () {
onRemoveId(e);
},
child: Icon(
Icons.highlight_remove,
size: 20,
))
],
),
))
.toList()),
), ),
]), ),
Expanded( Expanded(
child: TabBarView(controller: tabController, children: [ child: TabBarView(
RemotePage(key: ValueKey(connectionId), id: connectionId) children: connectionIds
])) .map((e) => Container(
], child: RemotePage(
key: ValueKey(e),
id: e))) //RemotePage(key: ValueKey(e), id: e))
.toList()),
)
],
),
),
); );
} }
void onRemoveId(String id) {
final indexOf = connectionIds.indexOf(id);
if (indexOf == -1) {
return;
}
setState(() {
connectionIds.removeAt(indexOf);
initialIndex = max(0, initialIndex - 1);
});
}
} }

View File

@ -1,6 +1,20 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "40.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -64,6 +78,62 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.11"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.2"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -78,6 +148,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -85,6 +162,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -92,6 +176,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0" version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cross_file: cross_file:
dependency: transitive dependency: transitive
description: description:
@ -113,6 +204,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
dash_chat: dash_chat:
dependency: "direct main" dependency: "direct main"
description: description:
@ -319,6 +417,41 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
freezed:
dependency: "direct dev"
description:
name: freezed
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3+1"
freezed_annotation:
dependency: "direct main"
description:
name: freezed_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -326,6 +459,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.13.4" version: "0.13.4"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -382,6 +522,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js: js:
dependency: transitive dependency: transitive
description: description:
@ -389,6 +536,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4" version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -410,6 +571,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@ -417,6 +585,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
package_info_plus: package_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -543,6 +718,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -557,6 +739,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0" version: "5.0.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
qr_code_scanner: qr_code_scanner:
dependency: "direct main" dependency: "direct main"
description: description:
@ -636,11 +832,32 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -662,6 +879,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -683,6 +907,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.9"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
toggle_switch: toggle_switch:
dependency: "direct main" dependency: "direct main"
description: description:
@ -816,6 +1047,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
win32: win32:
dependency: transitive dependency: transitive
description: description:

View File

@ -3,7 +3,7 @@ description: Your Remote Desktop Software
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application. # The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43 # A version number is three numbers separated by dots, like 1.2.43
@ -19,102 +19,102 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.1.10+27 version: 1.1.10+27
environment: environment:
sdk: ">=2.16.1" sdk: ">=2.16.1"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application.
# The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.
# Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.3
cupertino_icons: ^1.0.3 ffi: ^1.1.2
ffi: ^1.1.2 path_provider: ^2.0.2
path_provider: ^2.0.2 external_path: ^1.0.1
external_path: ^1.0.1 provider: ^5.0.0
provider: ^5.0.0 tuple: ^2.0.0
tuple: ^2.0.0 wakelock: ^0.5.2
wakelock: ^0.5.2 device_info_plus: ^3.2.3
device_info_plus: ^3.2.3 firebase_analytics: ^9.1.5
firebase_analytics: ^9.1.5 package_info_plus: ^1.4.2
package_info_plus: ^1.4.2 url_launcher: ^6.0.9
url_launcher: ^6.0.9 shared_preferences: ^2.0.6
shared_preferences: ^2.0.6 toggle_switch: ^1.4.0
toggle_switch: ^1.4.0 dash_chat: ^1.1.16
dash_chat: ^1.1.16 draggable_float_widget: ^0.0.2
draggable_float_widget: ^0.0.2 settings_ui: ^2.0.2
settings_ui: ^2.0.2 flutter_breadcrumb: ^1.0.1
flutter_breadcrumb: ^1.0.1 http: ^0.13.4
http: ^0.13.4 qr_code_scanner:
qr_code_scanner: git:
git: url: https://github.com/Heap-Hop/qr_code_scanner.git
url: https://github.com/Heap-Hop/qr_code_scanner.git ref: fix_break_changes_platform
ref: fix_break_changes_platform zxing2: ^0.1.0
zxing2: ^0.1.0 image_picker: ^0.8.5
image_picker: ^0.8.5 image: ^3.1.3
image: ^3.1.3 flutter_smart_dialog: ^4.3.1
flutter_smart_dialog: ^4.3.1 flutter_rust_bridge: ^1.30.0
flutter_rust_bridge: ^1.30.0 window_manager: ^0.2.3
window_manager: ^0.2.3 desktop_multi_window:
desktop_multi_window: git:
git: url: https://github.com/Kingtous/rustdesk_desktop_multi_window
url: https://github.com/Kingtous/rustdesk_desktop_multi_window ref: master
ref: master bitsdojo_window: ^0.1.2
bitsdojo_window: ^0.1.2 freezed_annotation: ^2.0.3
dev_dependencies: dev_dependencies:
flutter_launcher_icons: ^0.9.1 flutter_launcher_icons: ^0.9.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
build_runner: ^2.1.11
freezed: ^2.0.3
# rerun: flutter pub run flutter_launcher_icons:main # rerun: flutter pub run flutter_launcher_icons:main
flutter_icons: flutter_icons:
android: "ic_launcher" android: "ic_launcher"
ios: true ios: true
image_path: "../1024-rec.png" image_path: "../1024-rec.png"
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter. # The following section is specific to Flutter.
flutter: flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# The following line ensures that the Material Icons font is # To add assets to your application, add an assets section, like this:
# included with your application, so that you can use the icons in assets:
# the material Icons class. - assets/
uses-material-design: true
# To add assets to your application, add an assets section, like this: fonts:
assets: - family: GestureIcons
- assets/ fonts:
- asset: assets/gestures.ttf
fonts: # An image asset can refer to one or more resolution-specific "variants", see
- family: GestureIcons # https://flutter.dev/assets-and-images/#resolution-aware.
fonts:
- asset: assets/gestures.ttf
# An image asset can refer to one or more resolution-specific "variants", see # For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#from-packages
# For details regarding adding assets from package dependencies, see # To add custom fonts to your application, add a fonts section here,
# https://flutter.dev/assets-and-images/#from-packages # in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# To add custom fonts to your application, add a fonts section here, # list giving the asset and other descriptors for the font. For
# in this "flutter" section. Each entry in this list should have a # example:
# "family" key with the font family name, and a "fonts" key with a # fonts:
# list giving the asset and other descriptors for the font. For # - family: Schyler
# example: # fonts:
# fonts: # - asset: fonts/Schyler-Regular.ttf
# - family: Schyler # - asset: fonts/Schyler-Italic.ttf
# fonts: # style: italic
# - asset: fonts/Schyler-Regular.ttf # - family: Trajan Pro
# - asset: fonts/Schyler-Italic.ttf # fonts:
# style: italic # - asset: fonts/TrajanPro.ttf
# - family: Trajan Pro # - asset: fonts/TrajanPro_Bold.ttf
# fonts: # weight: 700
# - asset: fonts/TrajanPro.ttf #
# - asset: fonts/TrajanPro_Bold.ttf # For details regarding fonts from package dependencies,
# weight: 700 # see https://flutter.dev/custom-fonts/#from-packages
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages