fix: use multi window controller to close window
This commit is contained in:
parent
5a953cc8df
commit
d76782a0fc
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
@ -114,7 +115,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage>
|
||||
tabController.value = TabController(
|
||||
length: connectionIds.length, vsync: this, initialIndex: initialIndex);
|
||||
if (connectionIds.length == 0) {
|
||||
windowManager.close();
|
||||
WindowController.fromWindowId(windowId()).close();
|
||||
}
|
||||
}
|
||||
|
||||
int windowId() {
|
||||
return widget.params["windowId"];
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/desktop/pages/file_manager_page.dart';
|
||||
@ -114,7 +115,11 @@ class _FileManagerTabPageState extends State<FileManagerTabPage>
|
||||
tabController.value = TabController(
|
||||
length: connectionIds.length, initialIndex: initialIndex, vsync: this);
|
||||
if (connectionIds.length == 0) {
|
||||
windowManager.close();
|
||||
WindowController.fromWindowId(windowId()).close();
|
||||
}
|
||||
}
|
||||
|
||||
int windowId() {
|
||||
return widget.params["windowId"];
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ Future<Null> main(List<String> args) async {
|
||||
? Map<String, dynamic>()
|
||||
: jsonDecode(args[2]) as Map<String, dynamic>;
|
||||
int type = argument['type'] ?? -1;
|
||||
argument['windowId'] = windowId;
|
||||
WindowType wType = type.windowType;
|
||||
switch (wType) {
|
||||
case WindowType.RemoteDesktop:
|
||||
|
Loading…
x
Reference in New Issue
Block a user