new: server tag

This commit is contained in:
lollipopkit
2023-05-30 22:44:45 +08:00
parent 92ffed6541
commit 472a441c8e
23 changed files with 239 additions and 112 deletions

View File

@@ -14,6 +14,7 @@ import '../../../data/provider/server.dart';
import '../../../data/res/ui.dart';
import '../../../data/store/private_key.dart';
import '../../../locator.dart';
import '../../widget/tag.dart';
import '../private_key/edit.dart';
class ServerEditPage extends StatefulWidget {
@@ -43,6 +44,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
bool usePublicKey = false;
int? _pubKeyIndex;
PrivateKeyInfo? _keyInfo;
List<String> _tags = [];
@override
void initState() {
@@ -143,6 +145,13 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
icon: Icons.account_box,
hint: 'root',
),
TagEditor(
tags: _tags,
onChanged: (p0) => setState(() {
_tags = p0;
}),
s: _s,
),
width7,
Row(
children: [
@@ -262,6 +271,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
user: _usernameController.text,
pwd: authorization,
pubKeyId: usePublicKey ? _keyInfo!.id : null,
tags: _tags,
);
if (widget.spi == null) {
@@ -300,6 +310,9 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
} else {
usePublicKey = true;
}
if (widget.spi?.tags != null) {
_tags = widget.spi!.tags!;
}
setState(() {});
}
}