fix: keep window pos after new conn (#8834)

1. Keep window pos
2. Do some init in StatefulWidget constructor.
If try init in its state class, it may be too late. Because I see the
init function is called after building the widget tree.

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2024-07-25 21:52:57 +08:00
committed by GitHub
parent bbdce8d57b
commit 3999d498be
3 changed files with 14 additions and 7 deletions

View File

@@ -45,7 +45,9 @@ class RemotePage extends StatefulWidget {
this.switchUuid,
this.forceRelay,
this.isSharedPassword,
}) : super(key: key);
}) : super(key: key) {
initSharedStates(id);
}
final String id;
final SessionID? sessionId;
@@ -99,7 +101,6 @@ class _RemotePageState extends State<RemotePage>
}
void _initStates(String id) {
initSharedStates(id);
_zoomCursor = PeerBoolOption.find(id, kOptionZoomCursor);
_showRemoteCursor = ShowRemoteCursorState.find(id);
_keyboardEnabled = KeyboardEnabledState.find(id);