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,9 +37,7 @@ 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,
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Overlay(initialEntries: [ child: Overlay(initialEntries: [
@ -56,7 +56,11 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
)); ));
}) })
]), ]),
))); );
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,9 +67,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SubWindowDragToResizeArea( final tabWidget = Container(
windowId: windowId(),
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
@ -78,7 +77,12 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
onWindowCloseButton: handleWindowCloseButton, onWindowCloseButton: handleWindowCloseButton,
tail: const AddButton().paddingOnly(left: 10), tail: const AddButton().paddingOnly(left: 10),
)), )),
), );
return Platform.isMacOS
? tabWidget
: SubWindowDragToResizeArea(
windowId: windowId(),
child: tabWidget,
); );
} }

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,9 +75,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SubWindowDragToResizeArea( final tabWidget = Container(
windowId: windowId(),
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
@ -89,7 +88,12 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
}, },
tail: AddButton().paddingOnly(left: 10), tail: AddButton().paddingOnly(left: 10),
)), )),
), );
return Platform.isMacOS
? tabWidget
: SubWindowDragToResizeArea(
windowId: windowId(),
child: tabWidget,
); );
} }

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,10 +87,7 @@ 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,
windowId: windowId(),
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
@ -115,12 +113,12 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
], ],
); );
} else { } else {
final msgDirect = translate(connectionType.direct.value == final msgDirect = translate(
ConnectionType.strDirect connectionType.direct.value == ConnectionType.strDirect
? 'Direct Connection' ? 'Direct Connection'
: 'Relay Connection'); : 'Relay Connection');
final msgSecure = translate(connectionType.secure.value == final msgSecure = translate(
ConnectionType.strSecure connectionType.secure.value == ConnectionType.strSecure
? 'Secure Connection' ? 'Secure Connection'
: 'Insecure Connection'); : 'Insecure Connection');
return Row( return Row(
@ -141,8 +139,13 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
} }
}), }),
)), )),
), );
)); 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})
}); });
try {
final resp = final resp =
await http.post(Uri.parse(api), headers: authHeaders, body: body); await http.post(Uri.parse(api), headers: authHeaders, body: body);
abLoading = false; abError = "";
await getAb(); await getAb();
notifyListeners();
debugPrint("resp: ${resp.body}"); debugPrint("resp: ${resp.body}");
} catch (e) {
abError = e.toString();
} finally {
abLoading = false;
}
notifyListeners();
} }
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.