call tab onSelected at the end of tab's initState, needed by session

uuid

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-06-07 20:31:54 +08:00
parent 2ececed0c1
commit 60b87e554b
8 changed files with 58 additions and 28 deletions

View File

@@ -55,12 +55,14 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
final peerId = params['id'];
if (peerId != null) {
ConnectionTypeState.init(peerId);
tabController.onSelected = (_, id) {
tabController.onSelected = (id) {
final remotePage = tabController.state.value.tabs
.firstWhere((tab) => tab.key == id)
.page as RemotePage;
final ffi = remotePage.ffi;
bind.setCurSessionId(sessionId: ffi.sessionId);
.firstWhereOrNull((tab) => tab.key == id)
?.page;
if (remotePage is RemotePage) {
final ffi = remotePage.ffi;
bind.setCurSessionId(sessionId: ffi.sessionId);
}
WindowController.fromWindowId(windowId())
.setTitle(getWindowNameWithId(id));
};
@@ -75,6 +77,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
id: peerId,
password: params['password'],
menubarState: _menubarState,
tabController: tabController,
switchUuid: params['switch_uuid'],
forceRelay: params['forceRelay'],
),
@@ -111,6 +114,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
id: id,
password: args['password'],
menubarState: _menubarState,
tabController: tabController,
switchUuid: switchUuid,
forceRelay: args['forceRelay'],
),