Merge pull request #1501 from Heap-Hop/master

Update flutter desktop
This commit is contained in:
RustDesk
2022-09-13 09:50:36 +08:00
committed by GitHub
7 changed files with 155 additions and 88 deletions

View File

@@ -75,9 +75,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
backgroundColor: MyTheme.color(context).bg,
body: DesktopTab(
controller: tabController,
onWindowCloseButton: () {
tabController.clear();
},
onWindowCloseButton: handleWindowCloseButton,
tail: const AddButton().paddingOnly(left: 10),
)),
),
@@ -103,4 +101,21 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
tabController.closeBy(peerId);
}
}
Future<bool> handleWindowCloseButton() async {
final connLength = tabController.state.value.tabs.length;
if (connLength < 1) {
return true;
} else if (connLength == 1) {
final currentConn = tabController.state.value.tabs[0];
handleTabCloseButton(currentConn.key);
return false;
} else {
final res = await closeConfirmDialog();
if (res) {
tabController.clear();
}
return res;
}
}
}

View File

@@ -83,8 +83,9 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
backgroundColor: MyTheme.color(context).bg,
body: DesktopTab(
controller: tabController,
onWindowCloseButton: () {
onWindowCloseButton: () async {
tabController.clear();
return true;
},
tail: AddButton().paddingOnly(left: 10),
)),

View File

@@ -97,9 +97,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
body: DesktopTab(
controller: tabController,
showTabBar: fullscreen.isFalse,
onWindowCloseButton: () {
tabController.clear();
},
onWindowCloseButton: handleWindowCloseButton,
tail: AddButton().paddingOnly(left: 10),
pageViewBuilder: (pageView) {
WindowController.fromWindowId(windowId())
@@ -167,4 +165,21 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tabController.closeBy(peerId);
}
}
Future<bool> handleWindowCloseButton() async {
final connLength = tabController.state.value.tabs.length;
if (connLength < 1) {
return true;
} else if (connLength == 1) {
final currentConn = tabController.state.value.tabs[0];
handleTabCloseButton(currentConn.key);
return false;
} else {
final res = await closeConfirmDialog();
if (res) {
tabController.clear();
}
return res;
}
}
}