mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 18:04:18 +01:00
login and keys manage
This commit is contained in:
31
lib/component/user/user_name_component.dart
Normal file
31
lib/component/user/user_name_component.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nostr_sdk/nip19/nip19.dart';
|
||||
|
||||
class UserNameComponent extends StatefulWidget {
|
||||
String pubkey;
|
||||
|
||||
bool fullNpubName;
|
||||
|
||||
UserNameComponent(this.pubkey, {this.fullNpubName = false});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _UserNameComponent();
|
||||
}
|
||||
}
|
||||
|
||||
class _UserNameComponent extends State<UserNameComponent> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var npub = Nip19.encodePubKey(widget.pubkey);
|
||||
if (!widget.fullNpubName) {
|
||||
npub = Nip19.encodeSimplePubKey(widget.pubkey);
|
||||
}
|
||||
|
||||
return Text(
|
||||
npub,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user