diff --git a/flutter/lib/desktop/widgets/tabbar_widget.dart b/flutter/lib/desktop/widgets/tabbar_widget.dart index 03a8b6f01..9c88575ec 100644 --- a/flutter/lib/desktop/widgets/tabbar_widget.dart +++ b/flutter/lib/desktop/widgets/tabbar_widget.dart @@ -171,6 +171,7 @@ class DesktopTabController { class TabThemeConf { double iconSize; + TabThemeConf({required this.iconSize}); } @@ -199,6 +200,7 @@ class DesktopTab extends StatelessWidget { final Color? unSelectedTabBackgroundColor; final DesktopTabController controller; + Rx get state => controller.state; final isMaximized = false.obs; final _scrollDebounce = Debouncer(delay: Duration(milliseconds: 50)); @@ -606,7 +608,8 @@ Future closeConfirmDialog() async { setState(() => confirm = v); }, ) - ]), // confirm checkbox + ]), + // confirm checkbox actions: [ TextButton(onPressed: close, child: Text(translate("Cancel"))), ElevatedButton(onPressed: submit, child: Text(translate("OK"))), @@ -864,13 +867,14 @@ class _CloseButton extends StatelessWidget { } } -class ActionIcon extends StatelessWidget { +class ActionIcon extends StatefulWidget { final String? message; final IconData icon; final Function() onTap; final bool isClose; final double iconSize; final double boxSize; + const ActionIcon( {Key? key, this.message, @@ -881,31 +885,45 @@ class ActionIcon extends StatelessWidget { this.boxSize = _kTabBarHeight - 1}) : super(key: key); + @override + State createState() => _ActionIconState(); +} + +class _ActionIconState extends State { + var hover = false.obs; + + @override + void initState() { + super.initState(); + hover.value = false; + } + @override Widget build(BuildContext context) { - RxBool hover = false.obs; - return Obx(() => Tooltip( - message: message != null ? translate(message!) : "", - waitDuration: const Duration(seconds: 1), - child: InkWell( - hoverColor: isClose - ? const Color.fromARGB(255, 196, 43, 28) - : MyTheme.tabbar(context).hoverColor, - onHover: (value) => hover.value = value, - onTap: onTap, - child: SizedBox( - height: boxSize, - width: boxSize, - child: Icon( - icon, - color: hover.value && isClose - ? Colors.white - : MyTheme.tabbar(context).unSelectedIconColor, - size: iconSize, - ), + return Tooltip( + message: widget.message != null ? translate(widget.message!) : "", + waitDuration: const Duration(seconds: 1), + child: Obx( + () => InkWell( + hoverColor: widget.isClose + ? const Color.fromARGB(255, 196, 43, 28) + : MyTheme.tabbar(context).hoverColor, + onHover: (value) => hover.value = value, + onTap: widget.onTap, + child: SizedBox( + height: widget.boxSize, + width: widget.boxSize, + child: Icon( + widget.icon, + color: hover.value && widget.isClose + ? Colors.white + : MyTheme.tabbar(context).unSelectedIconColor, + size: widget.iconSize, ), ), - )); + ), + ), + ); } } diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index 4cef6efcf..17936ddff 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -64,7 +64,7 @@ dependencies: desktop_multi_window: git: url: https://github.com/Kingtous/rustdesk_desktop_multi_window - ref: 541f05f766c3f72984ff40b70dd3c7d061f2ce61 + ref: cbc172f02cf3ac136c7503015037e9867e594150 freezed_annotation: ^2.0.3 tray_manager: git: diff --git a/flutter/windows/runner/main.cpp b/flutter/windows/runner/main.cpp index fed399c9a..a6716990d 100644 --- a/flutter/windows/runner/main.cpp +++ b/flutter/windows/runner/main.cpp @@ -47,16 +47,18 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, std::vector rust_args(c_args, c_args + args_len); free_c_args(c_args, args_len); - // uni links dispatch - HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"rustdesk"); - if (hwnd != NULL) { - DispatchToUniLinksDesktop(hwnd); + // uni links dispatch + // only do uni links when dispatch a rustdesk links + if (!rust_args.empty() && rust_args.front().compare("rustdesk://") == 0) { + HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"rustdesk"); + if (hwnd != NULL) { + DispatchToUniLinksDesktop(hwnd); - ::ShowWindow(hwnd, SW_NORMAL); - ::SetForegroundWindow(hwnd); - return EXIT_FAILURE; + ::ShowWindow(hwnd, SW_NORMAL); + ::SetForegroundWindow(hwnd); + return EXIT_FAILURE; + } } - // Attach to console when present (e.g., 'flutter run') or create a // new console when running with a debugger. if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent())