mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-18 18:14:21 +01:00
user name component add show both support
This commit is contained in:
@@ -64,7 +64,11 @@ class _AuthDialog extends State<AuthDialogBaseComponnet> {
|
||||
for (var pubkey in pubkeys) {
|
||||
items.add(DropdownMenuItem(
|
||||
value: pubkey,
|
||||
child: UserNameComponent(pubkey),
|
||||
child: UserNameComponent(
|
||||
pubkey,
|
||||
showBoth: true,
|
||||
fullNpubName: true,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ class UserNameComponent extends StatefulWidget {
|
||||
|
||||
bool fullNpubName;
|
||||
|
||||
UserNameComponent(this.pubkey, {this.fullNpubName = false});
|
||||
bool showBoth;
|
||||
|
||||
UserNameComponent(this.pubkey,
|
||||
{this.fullNpubName = false, this.showBoth = false});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -30,10 +33,19 @@ class _UserNameComponent extends State<UserNameComponent> {
|
||||
var name = npub;
|
||||
|
||||
if (metadata != null) {
|
||||
String? niceName;
|
||||
if (StringUtil.isNotBlank(metadata.displayName)) {
|
||||
name = metadata.displayName!;
|
||||
niceName = metadata.displayName!;
|
||||
} else if (StringUtil.isNotBlank(metadata.name)) {
|
||||
name = metadata.name!;
|
||||
niceName = metadata.name!;
|
||||
}
|
||||
|
||||
if (StringUtil.isNotBlank(niceName)) {
|
||||
if (widget.showBoth) {
|
||||
name = "$niceName / $npub";
|
||||
} else {
|
||||
name = niceName!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user