Fix stale map labels, avatar initials and offline bubble widths
- Map node labels follow light/dark theme changes. - Avatar initials use only letters and digits; hop avatars fall back to the hash prefix. - Incoming channel bubbles are the same width connected and offline. - Day separators wrap instead of overflowing with large text.
This commit is contained in:
1 parent
34ea0cb7ca
commit
92dadb0d3a
12 files changed
+642
-48
No files matched your search
@@ -3958,8 +3958,10 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> {
|
||||
onPointerMove: _handleSwipePointerMove,
|
||||
onPointerUp: (event) => _handleSwipePointerUp(event.position),
|
||||
onPointerCancel: (_) => _resetSwipe(),
|
||||
// Same insets as the plain row in _buildMessageBubble, so a bubble is
|
||||
// as wide whether or not it can be swiped (offline, desktop, outgoing).
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
|
||||
@@ -21,6 +21,7 @@ import '../models/display_path.dart';
|
||||
import '../models/path_playback.dart';
|
||||
import '../theme/mesh_theme.dart';
|
||||
import '../widgets/adaptive_app_bar_title.dart';
|
||||
import '../widgets/contact_visuals.dart';
|
||||
import '../widgets/mesh_ui.dart';
|
||||
import '../widgets/path_map_scaffold.dart';
|
||||
import '../widgets/path_map_ui.dart';
|
||||
@@ -356,7 +357,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
AvatarCircle(name: hop.displayLabel, size: 36),
|
||||
AvatarCircle(name: hop.avatarName, size: 36),
|
||||
Positioned(
|
||||
right: -4,
|
||||
top: -4,
|
||||
@@ -1616,14 +1617,23 @@ class _PathHop {
|
||||
|
||||
bool get hasLocation => position != null;
|
||||
|
||||
String get displayLabel {
|
||||
final prefixLabel = hopBytes != null && hopBytes!.isNotEmpty
|
||||
? hopBytes!
|
||||
.map((b) => b.toRadixString(16).padLeft(2, '0'))
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
: _formatPrefix(prefix);
|
||||
return '($prefixLabel) ${_resolveName(contact, l10n)}';
|
||||
String get prefixLabel => hopBytes != null && hopBytes!.isNotEmpty
|
||||
? hopBytes!
|
||||
.map((b) => b.toRadixString(16).padLeft(2, '0'))
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
: _formatPrefix(prefix);
|
||||
|
||||
String get displayLabel => '($prefixLabel) ${_resolveName(contact, l10n)}';
|
||||
|
||||
/// Avatar source: the repeater's own name, or the hop's hex prefix when
|
||||
/// the hop is unresolved or its name has nothing to make initials from.
|
||||
String get avatarName {
|
||||
final name = contact?.name.trim() ?? '';
|
||||
if (name.toLowerCase() == 'unknown' || avatarInitials(name) == null) {
|
||||
return prefixLabel;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1198,6 +1198,9 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
||||
showOtherNodes: settings.mapShowOtherNodes,
|
||||
isBuildingPathTrace: _isBuildingPathTrace,
|
||||
clusterNodes: settings.mapClusterNodes,
|
||||
// Node labels bake in the overlay colors, so a light/dark or theme
|
||||
// switch must rebuild them.
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
);
|
||||
if (key != _nodeMarkersCacheKey) {
|
||||
_nodeMarkersCacheKey = key;
|
||||
@@ -4385,6 +4388,7 @@ class _NodeMarkersCacheKey {
|
||||
final bool showOtherNodes;
|
||||
final bool isBuildingPathTrace;
|
||||
final bool clusterNodes;
|
||||
final ColorScheme colorScheme;
|
||||
|
||||
const _NodeMarkersCacheKey({
|
||||
required this.contactsSignature,
|
||||
@@ -4405,6 +4409,7 @@ class _NodeMarkersCacheKey {
|
||||
required this.showOtherNodes,
|
||||
required this.isBuildingPathTrace,
|
||||
required this.clusterNodes,
|
||||
required this.colorScheme,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -4427,7 +4432,8 @@ class _NodeMarkersCacheKey {
|
||||
showChatNodes == other.showChatNodes &&
|
||||
showOtherNodes == other.showOtherNodes &&
|
||||
isBuildingPathTrace == other.isBuildingPathTrace &&
|
||||
clusterNodes == other.clusterNodes;
|
||||
clusterNodes == other.clusterNodes &&
|
||||
colorScheme == other.colorScheme;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4450,6 +4456,7 @@ class _NodeMarkersCacheKey {
|
||||
showOtherNodes,
|
||||
isBuildingPathTrace,
|
||||
clusterNodes,
|
||||
colorScheme,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user