#78 new: alter host

This commit is contained in:
lollipopkit
2023-07-28 13:59:32 +08:00
parent ed3201db6d
commit 389d1753c4
18 changed files with 101 additions and 36 deletions

View File

@@ -30,11 +30,13 @@ class ServerEditPage extends StatefulWidget {
class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
final _nameController = TextEditingController();
final _ipController = TextEditingController();
final _alterHostController = TextEditingController();
final _portController = TextEditingController();
final _usernameController = TextEditingController();
final _passwordController = TextEditingController();
final _nameFocus = FocusNode();
final _ipFocus = FocusNode();
final _alterHostFocus = FocusNode();
final _portFocus = FocusNode();
final _usernameFocus = FocusNode();
@@ -118,12 +120,20 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
Input(
controller: _ipController,
type: TextInputType.text,
onSubmitted: (_) => _focusScope.requestFocus(_portFocus),
onSubmitted: (_) => _focusScope.requestFocus(_alterHostFocus),
node: _ipFocus,
label: _s.host,
icon: Icons.storage,
icon: Icons.computer,
hint: 'example.com',
),
Input(
controller: _alterHostController,
type: TextInputType.text,
node: _alterHostFocus,
onSubmitted: (_) => _focusScope.requestFocus(_portFocus),
label: _s.alterHost,
icon: Icons.computer,
),
Input(
controller: _portController,
type: TextInputType.number,
@@ -280,6 +290,9 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
pwd: authorization,
pubKeyId: usePublicKey ? _keyInfo!.id : null,
tags: _tags,
alterHost: _alterHostController.text == ''
? null
: _alterHostController.text,
);
if (widget.spi == null) {
@@ -321,6 +334,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
if (widget.spi?.tags != null) {
_tags = widget.spi!.tags!;
}
_alterHostController.text = widget.spi?.alterHost ?? '';
setState(() {});
}
}