confirm connection tab close

This commit is contained in:
csf
2022-09-08 19:26:55 +08:00
parent 1c170366e7
commit b93e59df21
4 changed files with 38 additions and 12 deletions

View File

@@ -10,6 +10,8 @@ import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:get/get.dart';
import '../../mobile/widgets/dialog.dart';
class ConnectionTabPage extends StatefulWidget {
final Map<String, dynamic> params;
@@ -37,6 +39,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
label: peerId,
selectedIcon: selectedIcon,
unselectedIcon: unselectedIcon,
onTabCloseButton: () {
debugPrint("onTabCloseButton");
tabController.jumpBy(peerId);
clientClose(ffi(peerId).dialogManager);
},
page: Obx(() => RemotePage(
key: ValueKey(peerId),
id: peerId,
@@ -69,6 +76,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
label: id,
selectedIcon: selectedIcon,
unselectedIcon: unselectedIcon,
onTabCloseButton: () {
debugPrint("onTabCloseButton");
tabController.jumpBy(id);
clientClose(ffi(id).dialogManager);
},
page: Obx(() => RemotePage(
key: ValueKey(id),
id: id,
@@ -95,7 +107,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
body: Obx(() => DesktopTab(
controller: tabController,
showTabBar: fullscreen.isFalse,
onClose: () {
onWindowCloseButton: () {
tabController.clear();
},
tail: AddButton().paddingOnly(left: 10),

View File

@@ -71,10 +71,10 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
backgroundColor: MyTheme.color(context).bg,
body: DesktopTab(
controller: tabController,
onClose: () {
onWindowCloseButton: () {
tabController.clear();
},
tail: AddButton().paddingOnly(left: 10),
tail: const AddButton().paddingOnly(left: 10),
)),
),
);

View File

@@ -78,7 +78,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
backgroundColor: MyTheme.color(context).bg,
body: DesktopTab(
controller: tabController,
onClose: () {
onWindowCloseButton: () {
tabController.clear();
},
tail: AddButton().paddingOnly(left: 10),
@@ -88,7 +88,6 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
}
void onRemoveId(String id) {
ffi("pf_$id").close();
if (tabController.state.value.tabs.isEmpty) {
WindowController.fromWindowId(windowId()).hide();
}