Refact. Flutter web, mid commit (#7494)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-03-24 11:23:06 +08:00
committed by GitHub
parent 96e1b5b0f6
commit 85cafda168
33 changed files with 298 additions and 152 deletions

View File

@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:ui' as ui;
@@ -392,12 +391,12 @@ class DesktopTab extends StatelessWidget {
child: Row(
children: [
Offstage(
offstage: !Platform.isMacOS,
offstage: !isMacOS,
child: const SizedBox(
width: 78,
)),
Offstage(
offstage: kUseCompatibleUiMode || Platform.isMacOS,
offstage: kUseCompatibleUiMode || isMacOS,
child: Row(children: [
Offstage(
offstage: !showLogo,
@@ -585,7 +584,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
notMainWindowClose(WindowController controller) async {
if (widget.tabController.length != 0) {
debugPrint("close not emtpy multiwindow from taskbar");
if (Platform.isWindows) {
if (isWindows) {
await controller.show();
await controller.focus();
final res = await widget.onClose?.call() ?? true;
@@ -620,7 +619,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
await rustDeskWinManager.unregisterActiveWindow(kMainWindowId);
}
// macOS specific workaround, the window is not hiding when in fullscreen.
if (Platform.isMacOS && await windowManager.isFullScreen()) {
if (isMacOS && await windowManager.isFullScreen()) {
stateGlobal.closeOnFullscreen ??= true;
await windowManager.setFullScreen(false);
await macOSWindowClose(
@@ -634,7 +633,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
} else {
// it's safe to hide the subwindow
final controller = WindowController.fromWindowId(kWindowId!);
if (Platform.isMacOS) {
if (isMacOS) {
// onWindowClose() maybe called multiple times because of loopCloseWindow() in remote_tab_page.dart.
// use ??= to make sure the value is set on first call.
@@ -670,7 +669,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
child: Row(
children: [
Offstage(
offstage: !widget.showMinimize || Platform.isMacOS,
offstage: !widget.showMinimize || isMacOS,
child: ActionIcon(
message: 'Minimize',
icon: IconFont.min,
@@ -684,7 +683,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
isClose: false,
)),
Offstage(
offstage: !widget.showMaximize || Platform.isMacOS,
offstage: !widget.showMaximize || isMacOS,
child: Obx(() => ActionIcon(
message: stateGlobal.isMaximized.isTrue
? 'Restore'
@@ -698,7 +697,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
isClose: false,
))),
Offstage(
offstage: !widget.showClose || Platform.isMacOS,
offstage: !widget.showClose || isMacOS,
child: ActionIcon(
message: 'Close',
icon: IconFont.close,