Merge pull request #1578 from Kingtous/master

opt: binary name, macos frame, address book network catch
This commit is contained in:
RustDesk 2022-09-19 10:25:54 +08:00 committed by GitHub
commit de8596d6ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 138 additions and 117 deletions

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
@ -35,28 +37,30 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
RxBool fullscreen = false.obs; RxBool fullscreen = false.obs;
Get.put(fullscreen, tag: 'fullscreen'); Get.put(fullscreen, tag: 'fullscreen');
return Obx(() => DragToResizeArea( final tabWidget = Container(
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0, decoration: BoxDecoration(
child: Container( border: Border.all(color: MyTheme.color(context).border!)),
decoration: BoxDecoration( child: Overlay(initialEntries: [
border: Border.all(color: MyTheme.color(context).border!)), OverlayEntry(builder: (context) {
child: Overlay(initialEntries: [ gFFI.dialogManager.setOverlayState(Overlay.of(context));
OverlayEntry(builder: (context) { return Scaffold(
gFFI.dialogManager.setOverlayState(Overlay.of(context)); backgroundColor: MyTheme.color(context).bg,
return Scaffold( body: DesktopTab(
backgroundColor: MyTheme.color(context).bg, controller: tabController,
body: DesktopTab( tail: ActionIcon(
controller: tabController, message: 'Settings',
tail: ActionIcon( icon: IconFont.menu,
message: 'Settings', onTap: onAddSetting,
icon: IconFont.menu, isClose: false,
onTap: onAddSetting, ),
isClose: false, ));
), })
)); ]),
}) );
]), return Obx(() => Platform.isMacOS
))); ? tabWidget
: DragToResizeArea(
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0, child: tabWidget));
} }
void onAddSetting() { void onAddSetting() {

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -66,20 +67,23 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SubWindowDragToResizeArea( final tabWidget = Container(
windowId: windowId(), decoration: BoxDecoration(
child: Container( border: Border.all(color: MyTheme.color(context).border!)),
decoration: BoxDecoration( child: Scaffold(
border: Border.all(color: MyTheme.color(context).border!)), backgroundColor: MyTheme.color(context).bg,
child: Scaffold( body: DesktopTab(
backgroundColor: MyTheme.color(context).bg, controller: tabController,
body: DesktopTab( onWindowCloseButton: handleWindowCloseButton,
controller: tabController, tail: const AddButton().paddingOnly(left: 10),
onWindowCloseButton: handleWindowCloseButton, )),
tail: const AddButton().paddingOnly(left: 10),
)),
),
); );
return Platform.isMacOS
? tabWidget
: SubWindowDragToResizeArea(
windowId: windowId(),
child: tabWidget,
);
} }
void onRemoveId(String id) { void onRemoveId(String id) {

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -74,23 +75,26 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SubWindowDragToResizeArea( final tabWidget = Container(
windowId: windowId(), decoration: BoxDecoration(
child: Container( border: Border.all(color: MyTheme.color(context).border!)),
decoration: BoxDecoration( child: Scaffold(
border: Border.all(color: MyTheme.color(context).border!)), backgroundColor: MyTheme.color(context).bg,
child: Scaffold( body: DesktopTab(
backgroundColor: MyTheme.color(context).bg, controller: tabController,
body: DesktopTab( onWindowCloseButton: () async {
controller: tabController, tabController.clear();
onWindowCloseButton: () async { return true;
tabController.clear(); },
return true; tail: AddButton().paddingOnly(left: 10),
}, )),
tail: AddButton().paddingOnly(left: 10),
)),
),
); );
return Platform.isMacOS
? tabWidget
: SubWindowDragToResizeArea(
windowId: windowId(),
child: tabWidget,
);
} }
void onRemoveId(String id) { void onRemoveId(String id) {

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -86,63 +87,65 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final RxBool fullscreen = Get.find(tag: 'fullscreen'); final RxBool fullscreen = Get.find(tag: 'fullscreen');
return Obx(() => SubWindowDragToResizeArea( final tabWidget = Container(
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0, decoration: BoxDecoration(
windowId: windowId(), border: Border.all(color: MyTheme.color(context).border!)),
child: Container( child: Scaffold(
decoration: BoxDecoration( backgroundColor: MyTheme.color(context).bg,
border: Border.all(color: MyTheme.color(context).border!)), body: DesktopTab(
child: Scaffold( controller: tabController,
backgroundColor: MyTheme.color(context).bg, showTabBar: fullscreen.isFalse,
body: DesktopTab( onWindowCloseButton: handleWindowCloseButton,
controller: tabController, tail: const AddButton().paddingOnly(left: 10),
showTabBar: fullscreen.isFalse, pageViewBuilder: (pageView) {
onWindowCloseButton: handleWindowCloseButton, WindowController.fromWindowId(windowId())
tail: const AddButton().paddingOnly(left: 10), .setFullscreen(fullscreen.isTrue);
pageViewBuilder: (pageView) { return pageView;
WindowController.fromWindowId(windowId()) },
.setFullscreen(fullscreen.isTrue); tabBuilder: (key, icon, label, themeConf) => Obx(() {
return pageView; final connectionType = ConnectionTypeState.find(key);
}, if (!connectionType.isValid()) {
tabBuilder: (key, icon, label, themeConf) => Obx(() { return Row(
final connectionType = ConnectionTypeState.find(key); mainAxisAlignment: MainAxisAlignment.center,
if (!connectionType.isValid()) { children: [
return Row( icon,
mainAxisAlignment: MainAxisAlignment.center, label,
children: [ ],
icon, );
label, } else {
], final msgDirect = translate(
); connectionType.direct.value == ConnectionType.strDirect
} else { ? 'Direct Connection'
final msgDirect = translate(connectionType.direct.value == : 'Relay Connection');
ConnectionType.strDirect final msgSecure = translate(
? 'Direct Connection' connectionType.secure.value == ConnectionType.strSecure
: 'Relay Connection'); ? 'Secure Connection'
final msgSecure = translate(connectionType.secure.value == : 'Insecure Connection');
ConnectionType.strSecure return Row(
? 'Secure Connection' mainAxisAlignment: MainAxisAlignment.center,
: 'Insecure Connection'); children: [
return Row( icon,
mainAxisAlignment: MainAxisAlignment.center, Tooltip(
children: [ message: '$msgDirect\n$msgSecure',
icon, child: Image.asset(
Tooltip( 'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
message: '$msgDirect\n$msgSecure', width: themeConf.iconSize,
child: Image.asset( height: themeConf.iconSize,
'assets/${connectionType.secure.value}${connectionType.direct.value}.png', ).paddingOnly(right: 5),
width: themeConf.iconSize, ),
height: themeConf.iconSize, label,
).paddingOnly(right: 5), ],
), );
label, }
], }),
); )),
} );
}), return Obx(() => Platform.isMacOS
)), ? tabWidget
), : SubWindowDragToResizeArea(
)); resizeEdgeSize: fullscreen.value ? 1.0 : 8.0,
windowId: windowId(),
child: tabWidget));
} }
void onRemoveId(String id) { void onRemoveId(String id) {

View File

@ -45,8 +45,8 @@ class AbModel with ChangeNotifier {
} catch (err) { } catch (err) {
abError = err.toString(); abError = err.toString();
} finally { } finally {
notifyListeners();
abLoading = false; abLoading = false;
notifyListeners();
} }
return null; return null;
} }
@ -98,12 +98,18 @@ class AbModel with ChangeNotifier {
final body = jsonEncode({ final body = jsonEncode({
"data": jsonEncode({"tags": tags, "peers": peers}) "data": jsonEncode({"tags": tags, "peers": peers})
}); });
final resp = try {
await http.post(Uri.parse(api), headers: authHeaders, body: body); final resp =
abLoading = false; await http.post(Uri.parse(api), headers: authHeaders, body: body);
await getAb(); abError = "";
await getAb();
debugPrint("resp: ${resp.body}");
} catch (e) {
abError = e.toString();
} finally {
abLoading = false;
}
notifyListeners(); notifyListeners();
debugPrint("resp: ${resp.body}");
} }
bool idContainBy(String id) { bool idContainBy(String id) {

View File

@ -4,7 +4,7 @@ project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change # The name of the executable created for the application. Change this to change
# the on-disk name of your application. # the on-disk name of your application.
set(BINARY_NAME "flutter_hbb") set(BINARY_NAME "rustdesk")
# The unique GTK application identifier for this application. See: # The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID # https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.carriez.flutter_hbb") set(APPLICATION_ID "com.carriez.flutter_hbb")

View File

@ -5,7 +5,7 @@
// 'flutter create' template. // 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window. // The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = flutter_hbb PRODUCT_NAME = rustdesk
// The application's bundle identifier // The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.carriez.flutterHbb PRODUCT_BUNDLE_IDENTIFIER = com.carriez.flutterHbb

View File

@ -4,7 +4,7 @@ project(flutter_hbb LANGUAGES CXX)
# The name of the executable created for the application. Change this to change # The name of the executable created for the application. Change this to change
# the on-disk name of your application. # the on-disk name of your application.
set(BINARY_NAME "flutter_hbb") set(BINARY_NAME "rustdesk")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake. # versions of CMake.