desktop tab lable format: id/alias@hostname

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-09-26 15:11:31 +08:00
parent 4e97d2503b
commit e000fdfb50
8 changed files with 50 additions and 24 deletions

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:ui' as ui;
@ -267,13 +268,12 @@ class DesktopTab extends StatelessWidget {
tabType == DesktopTabType.install;
}
static RxString labelGetterAlias(String peerId) {
final opt = 'alias';
PeerStringOption.init(peerId, opt, () {
final alias = bind.mainGetPeerOptionSync(id: peerId, key: opt);
return alias.isEmpty ? peerId : alias;
static RxString tablabelGetter(String peerId) {
PeerStringOption.init(peerId, 'tabLabel', () {
final alias = bind.mainGetPeerOptionSync(id: peerId, key: 'alias');
return getDesktopTabLabel(peerId, alias);
});
return PeerStringOption.find(peerId, opt);
return PeerStringOption.find(peerId, 'tabLabel');
}
@override
@ -921,14 +921,17 @@ class _TabState extends State<_Tab> with RestorationMixin {
final labelWidget = Obx(() {
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: widget.maxLabelWidth ?? 200),
child: Text(
translate(widget.label.value),
textAlign: TextAlign.center,
style: TextStyle(
color: isSelected
? MyTheme.tabbar(context).selectedTextColor
: MyTheme.tabbar(context).unSelectedTextColor),
overflow: TextOverflow.ellipsis,
child: Tooltip(
message: translate(widget.label.value),
child: Text(
translate(widget.label.value),
textAlign: TextAlign.center,
style: TextStyle(
color: isSelected
? MyTheme.tabbar(context).selectedTextColor
: MyTheme.tabbar(context).unSelectedTextColor),
overflow: TextOverflow.ellipsis,
),
));
});