Show the routing key prefix on each contact
Contacts now show the first path-hash-width bytes of their public key as a monospace badge before the path label, so they can be matched to hops in routing paths and told apart. The width follows the radio's path hash size setting.
This commit is contained in:
1 parent
4c9705b3cb
commit
c296597a2d
24 files changed
+253
-2
No files matched your search
@@ -1884,9 +1884,13 @@ class _ContactTile extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
// Path / subtitle row
|
||||
// Key prefix + path / subtitle row
|
||||
Row(
|
||||
children: [
|
||||
_KeyPrefixBadge(
|
||||
prefix: contact.publicKeyPrefixHex(pathHashByteWidth),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
contact.pathLabel(
|
||||
@@ -1953,6 +1957,43 @@ class _ContactTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mono pill showing the contact's routing hash (public-key prefix), so it can
|
||||
/// be matched against hops in paths.
|
||||
class _KeyPrefixBadge extends StatelessWidget {
|
||||
final String prefix;
|
||||
|
||||
const _KeyPrefixBadge({required this.prefix});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return Semantics(
|
||||
label: context.l10n.contacts_keyPrefixSemantics(
|
||||
prefix.split('').join(' '),
|
||||
),
|
||||
excludeSemantics: true,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(MeshRadii.xs),
|
||||
border: Border.all(color: scheme.outline),
|
||||
),
|
||||
child: Text(
|
||||
prefix,
|
||||
maxLines: 1,
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: scheme.onSurface,
|
||||
letterSpacing: 0.6,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Disposes [controller] when the dialog content unmounts, i.e. after the
|
||||
/// route's exit animation, so the TextField never sees a disposed controller.
|
||||
class _DisposeControllerOnUnmount extends StatefulWidget {
|
||||
|
||||
Reference in new issue
Block a user