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