fix: ssh tab focus mgmt (#525)

Fixes #522
This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-11 22:36:52 +08:00
committed by GitHub
parent 568b97606a
commit 4d8268c614
8 changed files with 59 additions and 59 deletions

View File

@@ -32,6 +32,7 @@ class SSHPage extends StatefulWidget {
final bool notFromTab;
final Function()? onSessionEnd;
final GlobalKey<TerminalViewState>? terminalKey;
final FocusNode? focusNode;
const SSHPage({
super.key,
@@ -41,10 +42,9 @@ class SSHPage extends StatefulWidget {
this.notFromTab = true,
this.onSessionEnd,
this.terminalKey,
this.focusNode,
});
static final focusNode = FocusNode();
@override
State<SSHPage> createState() => SSHPageState();
}
@@ -158,7 +158,7 @@ class SSHPageState extends State<SSHPage>
CustomAppBar.barHeight ?? _media.padding.top,
),
hideScrollBar: false,
focusNode: SSHPage.focusNode,
focusNode: widget.focusNode,
),
),
);
@@ -432,7 +432,7 @@ class SSHPageState extends State<SSHPage>
widget.initSnippet!.runInTerm(_terminal, widget.spi);
}
SSHPage.focusNode.requestFocus();
widget.focusNode?.requestFocus();
await session.done;
if (mounted && widget.notFromTab) {