Show alias if set, on remote tab

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-11-12 22:33:10 +08:00
parent 082839ea91
commit 730cd4ab10
8 changed files with 55 additions and 2 deletions

View File

@@ -201,3 +201,25 @@ class RemoteCountState {
static RxInt find() => Get.find<RxInt>(tag: tag());
}
class PeerStringOption {
static String tag(String id, String opt) => 'peer_{$opt}_$id';
static void init(String id, String opt, String Function() init_getter) {
final key = tag(id, opt);
if (!Get.isRegistered(tag: key)) {
final RxString value = RxString(init_getter());
Get.put(value, tag: key);
}
}
static void delete(String id, String opt) {
final key = tag(id, opt);
if (Get.isRegistered(tag: key)) {
Get.delete(tag: key);
}
}
static RxString find(String id, String opt) =>
Get.find<RxString>(tag: tag(id, opt));
}

View File

@@ -584,7 +584,7 @@ abstract class BasePeerCard extends StatelessWidget {
submit() async {
isInProgress.value = true;
name = controller.text;
await bind.mainSetPeerOption(id: id, key: 'alias', value: name);
await bind.mainSetPeerAlias(id: id, alias: name);
if (isAddressBook) {
gFFI.abModel.setPeerAlias(id, name);
await gFFI.abModel.pushAb();