upd - fix and format

This commit is contained in:
HDDen
2026-06-14 01:36:49 +03:00
parent d61eaaaff1
commit e92d215582
7 changed files with 32 additions and 18 deletions
+16 -3
View File
@@ -515,6 +515,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
final displayPathHashWidth =
message.pathHashWidth ??
context.read<MeshCoreConnector>().pathHashByteWidth;
final displayHopCount = _displayHopCount(
displayPath,
displayPathHashWidth,
message.pathLength,
);
// Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk.
final bubbleColor = isOutgoing
@@ -665,9 +670,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
children: [
RouteChip(
isDirect: (message.pathLength ?? -1) >= 0,
hops: (message.pathLength ?? -1) >= 0
? message.pathLength
: null,
hops: displayHopCount,
),
const SizedBox(width: 4),
Text(
@@ -1564,6 +1567,16 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
).map(PathHelper.formatHopHex).join(',');
}
int? _displayHopCount(
Uint8List pathBytes,
int pathHashByteWidth,
int? fallbackPathLength,
) {
if ((fallbackPathLength ?? -1) < 0) return null;
if (pathBytes.isEmpty) return fallbackPathLength;
return PathHelper.splitPathBytes(pathBytes, pathHashByteWidth).length;
}
/// Deterministic name-to-hue mapping consistent with [AvatarCircle].
Color _colorForName(String name) {
const hues = [