mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-21 07:57:50 +08:00
85cafda168
Signed-off-by: fufesou <shuanglongchen@yeah.net>
36 lines
1.0 KiB
Dart
36 lines
1.0 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_hbb/main.dart';
|
|
import 'package:flutter_hbb/common.dart';
|
|
|
|
enum SystemWindowTheme { light, dark }
|
|
|
|
/// The platform channel for RustDesk.
|
|
class RdPlatformChannel {
|
|
RdPlatformChannel._();
|
|
|
|
static final RdPlatformChannel _windowUtil = RdPlatformChannel._();
|
|
|
|
static RdPlatformChannel get instance => _windowUtil;
|
|
|
|
final MethodChannel _osxMethodChannel =
|
|
MethodChannel("org.rustdesk.rustdesk/macos");
|
|
|
|
/// Change the theme of the system window
|
|
Future<void> changeSystemWindowTheme(SystemWindowTheme theme) {
|
|
assert(isMacOS);
|
|
if (kDebugMode) {
|
|
print(
|
|
"[Window ${kWindowId ?? 'Main'}] change system window theme to ${theme.name}");
|
|
}
|
|
return _osxMethodChannel
|
|
.invokeMethod("setWindowTheme", {"themeName": theme.name});
|
|
}
|
|
|
|
/// Terminate .app manually.
|
|
Future<void> terminate() {
|
|
assert(isMacOS);
|
|
return _osxMethodChannel.invokeMethod("terminate");
|
|
}
|
|
}
|