fix: close one connection tab will dispose all tabs (Obx)

This commit is contained in:
csf 2022-09-08 20:43:27 +08:00
parent b93e59df21
commit 63cb816b7d

View File

@ -44,12 +44,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tabController.jumpBy(peerId); tabController.jumpBy(peerId);
clientClose(ffi(peerId).dialogManager); clientClose(ffi(peerId).dialogManager);
}, },
page: Obx(() => RemotePage( page: RemotePage(
key: ValueKey(peerId), key: ValueKey(peerId),
id: peerId, id: peerId,
tabBarHeight: tabBarHeight: fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight,
fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight, )));
))));
} }
} }
@ -81,12 +80,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tabController.jumpBy(id); tabController.jumpBy(id);
clientClose(ffi(id).dialogManager); clientClose(ffi(id).dialogManager);
}, },
page: Obx(() => RemotePage( page: RemotePage(
key: ValueKey(id), key: ValueKey(id),
id: id, id: id,
tabBarHeight: tabBarHeight: fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight,
fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight, )));
))));
} else if (call.method == "onDestroy") { } else if (call.method == "onDestroy") {
tabController.clear(); tabController.clear();
} }
@ -104,7 +102,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
backgroundColor: MyTheme.color(context).bg, backgroundColor: MyTheme.color(context).bg,
body: Obx(() => DesktopTab( body: DesktopTab(
controller: tabController, controller: tabController,
showTabBar: fullscreen.isFalse, showTabBar: fullscreen.isFalse,
onWindowCloseButton: () { onWindowCloseButton: () {
@ -127,13 +125,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
], ],
); );
} else { } else {
final msgDirect = translate( final msgDirect = translate(connectionType.direct.value ==
connectionType.direct.value ==
ConnectionType.strDirect ConnectionType.strDirect
? 'Direct Connection' ? 'Direct Connection'
: 'Relay Connection'); : 'Relay Connection');
final msgSecure = translate( final msgSecure = translate(connectionType.secure.value ==
connectionType.secure.value ==
ConnectionType.strSecure ConnectionType.strSecure
? 'Secure Connection' ? 'Secure Connection'
: 'Insecure Connection'); : 'Insecure Connection');
@ -154,7 +150,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
); );
} }
}), }),
))), )),
), ),
)); ));
} }