fix: close one connection tab will dispose all tabs (Obx)
This commit is contained in:
parent
b93e59df21
commit
63cb816b7d
@ -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,57 +102,55 @@ 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: () {
|
||||||
tabController.clear();
|
tabController.clear();
|
||||||
},
|
},
|
||||||
tail: AddButton().paddingOnly(left: 10),
|
tail: AddButton().paddingOnly(left: 10),
|
||||||
pageViewBuilder: (pageView) {
|
pageViewBuilder: (pageView) {
|
||||||
WindowController.fromWindowId(windowId())
|
WindowController.fromWindowId(windowId())
|
||||||
.setFullscreen(fullscreen.isTrue);
|
.setFullscreen(fullscreen.isTrue);
|
||||||
return pageView;
|
return pageView;
|
||||||
},
|
},
|
||||||
tabBuilder: (key, icon, label, themeConf) => Obx(() {
|
tabBuilder: (key, icon, label, themeConf) => Obx(() {
|
||||||
final connectionType = ConnectionTypeState.find(key);
|
final connectionType = ConnectionTypeState.find(key);
|
||||||
if (!connectionType.isValid()) {
|
if (!connectionType.isValid()) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
icon,
|
icon,
|
||||||
label,
|
label,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} 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(connectionType.secure.value ==
|
||||||
final msgSecure = translate(
|
ConnectionType.strSecure
|
||||||
connectionType.secure.value ==
|
? 'Secure Connection'
|
||||||
ConnectionType.strSecure
|
: 'Insecure Connection');
|
||||||
? 'Secure Connection'
|
return Row(
|
||||||
: 'Insecure Connection');
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
return Row(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
icon,
|
||||||
children: [
|
Tooltip(
|
||||||
icon,
|
message: '$msgDirect\n$msgSecure',
|
||||||
Tooltip(
|
child: Image.asset(
|
||||||
message: '$msgDirect\n$msgSecure',
|
'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
|
||||||
child: Image.asset(
|
width: themeConf.iconSize,
|
||||||
'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
|
height: themeConf.iconSize,
|
||||||
width: themeConf.iconSize,
|
).paddingOnly(right: 5),
|
||||||
height: themeConf.iconSize,
|
),
|
||||||
).paddingOnly(right: 5),
|
label,
|
||||||
),
|
],
|
||||||
label,
|
);
|
||||||
],
|
}
|
||||||
);
|
}),
|
||||||
}
|
)),
|
||||||
}),
|
|
||||||
))),
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user