Open repeater details from the nearby repeaters list

Each nearby repeater is now a tappable row that opens the same node
details sheet as the map, or a short sheet with the key prefix and
signal when the repeater isn't a known contact. The map's node info
sheet and login dialogs move to widgets/node_info_sheet.dart so both
places share them.
This commit is contained in:
zjs81 committed 2026-10-24 21:01:47 -07:00
1 parent caf20b4415
commit c131f56dae
24 files changed
+616 -331

No files matched your search

+2
View File
@@ -2759,6 +2759,8 @@
"snrIndicator_nearByRepeaters": "Nearby Repeaters",
"snrIndicator_lastSeen": "Last seen",
"snrIndicator_nearByRepeatersDescription": "Repeaters your radio heard directly, most recently heard first.",
"snrIndicator_unknownRepeater": "Unknown repeater",
"snrIndicator_unknownRepeaterHint": "This repeater isn't in your contacts yet. Its name, location and options appear once your radio receives its advert.",
"contactsSettings_title": "Contacts settings",
"contactsSettings_autoAddTitle": "Automatic Discovery",
"contactsSettings_otherTitle": "Other contact related settings",
+12
View File
@@ -8342,6 +8342,18 @@ abstract class AppLocalizations {
/// **'Repeaters your radio heard directly, most recently heard first.'**
String get snrIndicator_nearByRepeatersDescription;
/// No description provided for @snrIndicator_unknownRepeater.
///
/// In en, this message translates to:
/// **'Unknown repeater'**
String get snrIndicator_unknownRepeater;
/// No description provided for @snrIndicator_unknownRepeaterHint.
///
/// In en, this message translates to:
/// **'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.'**
String get snrIndicator_unknownRepeaterHint;
/// No description provided for @contactsSettings_title.
///
/// In en, this message translates to:
+7
View File
@@ -4889,6 +4889,13 @@ class AppLocalizationsBg extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Повторители, чути от вашето радио пряко, първо най-скорошните.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Настройки на контактите';
+7
View File
@@ -4900,6 +4900,13 @@ class AppLocalizationsDe extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repeater, die Ihr Funkgerät direkt gehört hat, zuletzt gehört zuerst.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Kontakteinstellungen';
+7
View File
@@ -4823,6 +4823,13 @@ class AppLocalizationsEn extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repeaters your radio heard directly, most recently heard first.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Contacts settings';
+7
View File
@@ -4891,6 +4891,13 @@ class AppLocalizationsEs extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repetidores que tu radio ha oído directamente, del más reciente al más antiguo.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Configuración de contactos';
+7
View File
@@ -4913,6 +4913,13 @@ class AppLocalizationsFr extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Les répéteurs entendus directement par votre radio, du plus récent au plus ancien.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Paramètres des contacts';
+7
View File
@@ -4887,6 +4887,13 @@ class AppLocalizationsHu extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Azok az átjátszók, amelyeket a rádió közvetlenül hallott, a legutóbb hallottak elöl.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Névjegyek beállításai';
+7
View File
@@ -4898,6 +4898,13 @@ class AppLocalizationsIt extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Ripetitori che la tua radio ha sentito direttamente, dal più recente al più vecchio.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Impostazioni dei contatti';
+7
View File
@@ -4654,6 +4654,13 @@ class AppLocalizationsJa extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'ラジオが直接受信したリピータ(最近受信した順)';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => '連絡先設定';
+7
View File
@@ -4664,6 +4664,13 @@ class AppLocalizationsKo extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'이 라디오가 직접 들은 리피터입니다. 가장 최근에 들은 순으로 표시됩니다.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => '연락처 설정';
+7
View File
@@ -4865,6 +4865,13 @@ class AppLocalizationsNl extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repeaters die je radio rechtstreeks heeft gehoord, meest recent gehoord eerst.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Instellingen voor contacten';
+7
View File
@@ -4923,6 +4923,13 @@ class AppLocalizationsPl extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Przekaźniki usłyszane bezpośrednio przez Twoje radio, najpierw te ostatnio usłyszane.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Ustawienia kontaktów';
+7
View File
@@ -4892,6 +4892,13 @@ class AppLocalizationsPt extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repetidores que o seu rádio ouviu diretamente, do mais recente para o mais antigo.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Configurações de contatos';
+7
View File
@@ -4906,6 +4906,13 @@ class AppLocalizationsRu extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Ретрансляторы, услышанные вашим радио напрямую, сначала самые недавние.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Настройки контактов';
+7
View File
@@ -4876,6 +4876,13 @@ class AppLocalizationsSk extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Opakovače, ktoré vaše rádio počulo priamo, najskôr tie naposledy počuté.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Nastavenia kontaktov';
+7
View File
@@ -4877,6 +4877,13 @@ class AppLocalizationsSl extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Ponovitelji, ki jih je vaše radio slišalo neposredno, najprej nazadnje slišani.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Nastavitve stikov';
+7
View File
@@ -4849,6 +4849,13 @@ class AppLocalizationsSv extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Repeatrar som din radio hörde direkt, senast hörda först.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Kontaktinställningar';
+7
View File
@@ -4905,6 +4905,13 @@ class AppLocalizationsUk extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'Ретранслятори, почуті вашим радіо безпосередньо, спочатку найновіші.';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => 'Налаштування контактів';
+7
View File
@@ -4539,6 +4539,13 @@ class AppLocalizationsZh extends AppLocalizations {
String get snrIndicator_nearByRepeatersDescription =>
'你的无线电直接听到的中继器,最近听到的排在前面。';
@override
String get snrIndicator_unknownRepeater => 'Unknown repeater';
@override
String get snrIndicator_unknownRepeaterHint =>
'This repeater isn\'t in your contacts yet. Its name, location and options appear once your radio receives its advert.';
@override
String get contactsSettings_title => '联系人设置';
+34 -291
View File
@@ -41,14 +41,12 @@ import 'chat_screen.dart';
import 'contacts_screen.dart';
import '../theme/mesh_theme.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/repeater_login_dialog.dart';
import '../widgets/room_login_dialog.dart';
import '../widgets/node_info_sheet.dart';
import '../widgets/set_my_location_dialog.dart';
import '../helpers/guessed_location_estimator.dart';
import '../helpers/marker_message.dart';
import '../helpers/snack_bar_builder.dart';
import '../helpers/utf8_length_limiter.dart';
import 'repeater_hub_screen.dart';
import 'settings_screen.dart';
import 'line_of_sight_map_screen.dart';
@@ -250,8 +248,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
connector: connector,
repeater: repeater,
onManage: (contact) => contact.type == advTypeRoom
? _showRoomLogin(context, contact, manage: true)
: _showRepeaterLogin(context, contact),
? showRoomLoginDialog(context, contact, manage: true)
: showRepeaterLoginDialog(context, contact),
);
}
@@ -784,8 +782,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
LineOfSightEndpoint(
label: c.name,
point: LatLng(c.latitude!, c.longitude!),
color: _getNodeColor(c.type),
icon: _getNodeIcon(c.type),
color: mapNodeTypeColor(c.type),
icon: mapNodeTypeIcon(c.type),
),
);
}
@@ -1308,17 +1306,17 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
continue;
}
final color = _getNodeColor(guess.contact.type);
final color = mapNodeTypeColor(guess.contact.type);
final marker = Marker(
point: guess.position,
width: 48,
height: 48,
child: GestureDetector(
onLongPress: () {
if (_isBuildingPathTrace) _showNodeInfo(context, guess.contact);
if (_isBuildingPathTrace) showNodeInfoSheet(context, guess.contact);
},
onSecondaryTap: () {
if (_isBuildingPathTrace) _showNodeInfo(context, guess.contact);
if (_isBuildingPathTrace) showNodeInfoSheet(context, guess.contact);
},
onTap: () => _isBuildingPathTrace
? _addToPath(context, guess.contact, position: guess.position)
@@ -1550,10 +1548,10 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onLongPress: () {
if (_isBuildingPathTrace) _showNodeInfo(context, contact);
if (_isBuildingPathTrace) showNodeInfoSheet(context, contact);
},
onSecondaryTap: () {
if (_isBuildingPathTrace) _showNodeInfo(context, contact);
if (_isBuildingPathTrace) showNodeInfoSheet(context, contact);
},
onTap: () => _isBuildingPathTrace
? _addToPath(context, contact)
@@ -1581,7 +1579,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
)
: _buildNodeMarkerWidget(
color: baseColor,
icon: _getNodeIcon(contact.type),
icon: mapNodeTypeIcon(contact.type),
selected: selected,
stale: stale,
online: online,
@@ -1725,21 +1723,6 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
);
}
Color _getNodeColor(int type) {
switch (type) {
case advTypeChat:
return MapPalette.selected;
case advTypeRepeater:
return MapPalette.repeater;
case advTypeRoom:
return MapPalette.router;
case advTypeSensor:
return MapPalette.sensor;
default:
return MapPalette.offline;
}
}
Color _markerColor(Contact contact) {
switch (contact.type) {
case advTypeRepeater:
@@ -1766,21 +1749,6 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
return estimateBatteryPercentFromMillivolts(millivolts, chemistry) <= 20;
}
IconData _getNodeIcon(int type) {
switch (type) {
case advTypeChat:
return Icons.person;
case advTypeRepeater:
return Icons.router;
case advTypeRoom:
return Icons.meeting_room;
case advTypeSensor:
return Icons.sensors;
default:
return Icons.device_unknown;
}
}
Widget _buildNodeMarkerWidget({
required Color color,
required IconData icon,
@@ -2179,7 +2147,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
Divider(height: 1, color: _overlayBorderColor),
itemBuilder: (context, index) {
final c = results[index];
final color = _getNodeColor(c.type);
final color = mapNodeTypeColor(c.type);
return InkWell(
onTap: () => _onSearchResultTap(c, guessedLocations),
child: Padding(
@@ -2189,7 +2157,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
),
child: Row(
children: [
Icon(_getNodeIcon(c.type), size: 18, color: color),
Icon(mapNodeTypeIcon(c.type), size: 18, color: color),
const SizedBox(width: 10),
Expanded(
child: Column(
@@ -2265,7 +2233,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
_searchController.clear();
_searchFocus.unfocus();
});
_showNodeInfo(context, contact);
showNodeInfoSheet(context, contact);
}
}
@@ -2413,7 +2381,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
name: contact.name,
size: 38,
color: color,
icon: _getNodeIcon(contact.type),
icon: mapNodeTypeIcon(contact.type),
),
const SizedBox(width: 10),
Expanded(
@@ -2490,7 +2458,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
children: [
_miniMeta(
context.l10n.map_lastSeen,
_formatLastSeen(contact.lastSeen),
formatNodeLastSeen(context.l10n, contact.lastSeen),
),
_miniMeta(
context.l10n.map_path,
@@ -2521,7 +2489,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
style: TextButton.styleFrom(
foregroundColor: MapPalette.selected,
),
onPressed: () => _showNodeInfo(
onPressed: () => showNodeInfoSheet(
context,
contact,
guessedPosition: contact.hasLocation
@@ -2605,7 +2573,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
_showRepeaterLogin(context, contact);
showRepeaterLoginDialog(context, contact);
}),
];
case advTypeRoom:
@@ -2614,13 +2582,13 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
_showRoomLogin(context, contact);
showRoomLoginDialog(context, contact);
}),
action(context.l10n.map_manageServer, Icons.room_preferences, () {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
_showRoomLogin(context, contact, manage: true);
showRoomLoginDialog(context, contact, manage: true);
}),
];
default:
@@ -2952,7 +2920,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
overflow: TextOverflow.ellipsis,
),
subtitle: Text(
'${marker.fromName} · ${_formatLastSeen(marker.timestamp)}',
'${marker.fromName} · ${formatNodeLastSeen(context.l10n, marker.timestamp)}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -2973,193 +2941,6 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
);
}
void _showRepeaterLogin(BuildContext context, Contact repeater) {
showDialog(
context: context,
builder: (context) => RepeaterLoginDialog(
repeater: repeater,
onLogin: (password, isAdmin) {
// Navigate to repeater hub screen after successful login
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RepeaterHubScreen(
repeater: repeater,
password: password,
isAdmin: isAdmin,
),
),
);
},
),
);
}
void _showRoomLogin(
BuildContext context,
Contact room, {
bool manage = false,
}) {
showDialog(
context: context,
builder: (context) => RoomLoginDialog(
room: room,
onLogin: (password, isAdmin) {
final connector = context.read<MeshCoreConnector>();
final unread = connector.getUnreadCountForContactKey(
room.publicKeyHex,
);
connector.markContactRead(room.publicKeyHex);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => manage
? RepeaterHubScreen(
repeater: room,
password: password,
isAdmin: isAdmin,
)
: ChatScreen(contact: room, initialUnreadCount: unread),
),
);
},
),
);
}
void _showNodeInfo(
BuildContext context,
Contact contact, {
LatLng? guessedPosition,
}) {
final connector = context.read<MeshCoreConnector>();
showMeshSheet(
context,
builder: (sheetContext) {
final actions = <Widget>[];
if (contact.type == advTypeChat) {
actions.add(
FilledButton(
onPressed: () {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
final unread = connector.getUnreadCountForContactKey(
contact.publicKeyHex,
);
Navigator.pop(sheetContext);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChatScreen(
contact: contact,
initialUnreadCount: unread,
),
),
);
},
child: Text(context.l10n.contacts_openChat),
),
);
}
if (contact.type == advTypeRepeater) {
actions.add(
FilledButton(
onPressed: () {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
Navigator.pop(sheetContext);
_showRepeaterLogin(context, contact);
},
child: Text(context.l10n.map_manageRepeater),
),
);
}
if (contact.type == advTypeRoom) {
actions.add(
FilledButton(
onPressed: () {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
Navigator.pop(sheetContext);
_showRoomLogin(context, contact);
},
child: Text(context.l10n.map_joinRoom),
),
);
actions.add(
FilledButton(
onPressed: () {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
Navigator.pop(sheetContext);
_showRoomLogin(context, contact, manage: true);
},
child: Text(context.l10n.map_manageServer),
),
);
}
return SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetHeader(
title: contact.name,
subtitle: contact.typeLabel(context.l10n),
trailing: Icon(
_getNodeIcon(contact.type),
color: _getNodeColor(contact.type),
size: 20,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoRow(
context.l10n.map_path,
contact.pathLabel(
context.l10n,
pathHashByteWidth: connector.pathHashByteWidth,
),
),
if (contact.hasLocation)
_buildInfoRow(
context.l10n.map_location,
'${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}',
)
else if (guessedPosition != null)
_buildInfoRow(
context.l10n.map_estLocation,
'~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}',
),
_buildInfoRow(
context.l10n.map_lastSeen,
_formatLastSeen(contact.lastSeen),
),
_buildInfoRow(
context.l10n.map_publicKey,
contact.publicKeyHex,
),
const SizedBox(height: 16),
...actions,
],
),
),
],
),
),
);
},
);
}
void _handleQuickSwitch(int index, BuildContext context) {
if (index == 2) return;
switch (index) {
@@ -3216,18 +2997,22 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoRow(context.l10n.map_from, marker.fromName),
_buildInfoRow(context.l10n.map_source, marker.sourceLabel),
_buildInfoRow(
context.l10n.map_sharedAt,
_formatLastSeen(marker.timestamp),
NodeInfoRow(label: context.l10n.map_from, value: marker.fromName),
NodeInfoRow(
label: context.l10n.map_source,
value: marker.sourceLabel,
),
_buildInfoRow(
context.l10n.map_location,
'${marker.position.latitude.toStringAsFixed(6)}, ${marker.position.longitude.toStringAsFixed(6)}',
NodeInfoRow(
label: context.l10n.map_sharedAt,
value: formatNodeLastSeen(context.l10n, marker.timestamp),
),
NodeInfoRow(
label: context.l10n.map_location,
value:
'${marker.position.latitude.toStringAsFixed(6)}, ${marker.position.longitude.toStringAsFixed(6)}',
),
if (marker.flags.isNotEmpty)
_buildInfoRow(context.l10n.map_flags, marker.flags),
NodeInfoRow(label: context.l10n.map_flags, value: marker.flags),
const SizedBox(height: 12),
Text(
context.l10n.map_markerHideHint,
@@ -3316,48 +3101,6 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
);
}
Widget _buildInfoRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
SelectableText(
value,
style: MeshTheme.mono(
fontSize: 13,
color: Theme.of(context).colorScheme.onSurface,
),
),
],
),
);
}
String _formatLastSeen(DateTime lastSeen) {
final now = DateTime.now();
final difference = now.difference(lastSeen);
if (difference.inSeconds < 60) {
return context.l10n.time_justNow;
} else if (difference.inMinutes < 60) {
return context.l10n.time_minutesAgo(difference.inMinutes);
} else if (difference.inHours < 24) {
return context.l10n.time_hoursAgo(difference.inHours);
} else {
return context.l10n.time_daysAgo(difference.inDays);
}
}
void _showShareMarkerAtPositionSheet({
required BuildContext context,
required MeshCoreConnector connector,
+282
View File
@@ -0,0 +1,282 @@
import 'package:flutter/material.dart';
import 'package:latlong2/latlong.dart';
import 'package:provider/provider.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../l10n/app_localizations.dart';
import '../l10n/contact_localization.dart';
import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../screens/chat_screen.dart';
import '../screens/repeater_hub_screen.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
import 'repeater_login_dialog.dart';
import 'room_login_dialog.dart';
/// Map accent colour for a node type.
Color mapNodeTypeColor(int type) {
switch (type) {
case advTypeChat:
return MapPalette.selected;
case advTypeRepeater:
return MapPalette.repeater;
case advTypeRoom:
return MapPalette.router;
case advTypeSensor:
return MapPalette.sensor;
default:
return MapPalette.offline;
}
}
/// Map icon for a node type.
IconData mapNodeTypeIcon(int type) {
switch (type) {
case advTypeChat:
return Icons.person;
case advTypeRepeater:
return Icons.router;
case advTypeRoom:
return Icons.meeting_room;
case advTypeSensor:
return Icons.sensors;
default:
return Icons.device_unknown;
}
}
String formatNodeLastSeen(AppLocalizations l10n, DateTime lastSeen) {
final difference = DateTime.now().difference(lastSeen);
if (difference.inSeconds < 60) {
return l10n.time_justNow;
} else if (difference.inMinutes < 60) {
return l10n.time_minutesAgo(difference.inMinutes);
} else if (difference.inHours < 24) {
return l10n.time_hoursAgo(difference.inHours);
} else {
return l10n.time_daysAgo(difference.inDays);
}
}
/// Label above a selectable mono value, as used in node detail sheets.
class NodeInfoRow extends StatelessWidget {
final String label;
final String value;
const NodeInfoRow({super.key, required this.label, required this.value});
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 12,
color: scheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
SelectableText(
value,
style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface),
),
],
),
);
}
}
/// Repeater login, then the repeater hub on success.
void showRepeaterLoginDialog(BuildContext context, Contact repeater) {
showDialog(
context: context,
builder: (context) => RepeaterLoginDialog(
repeater: repeater,
onLogin: (password, isAdmin) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RepeaterHubScreen(
repeater: repeater,
password: password,
isAdmin: isAdmin,
),
),
);
},
),
);
}
/// Room login, then the room chat (or the hub when [manage] is set).
void showRoomLoginDialog(
BuildContext context,
Contact room, {
bool manage = false,
}) {
showDialog(
context: context,
builder: (context) => RoomLoginDialog(
room: room,
onLogin: (password, isAdmin) {
final connector = context.read<MeshCoreConnector>();
final unread = connector.getUnreadCountForContactKey(room.publicKeyHex);
connector.markContactRead(room.publicKeyHex);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => manage
? RepeaterHubScreen(
repeater: room,
password: password,
isAdmin: isAdmin,
)
: ChatScreen(contact: room, initialUnreadCount: unread),
),
);
},
),
);
}
/// Node details sheet (path, location, last seen, key) with the actions for
/// its type: open chat, manage repeater, or join/manage room.
void showNodeInfoSheet(
BuildContext context,
Contact contact, {
LatLng? guessedPosition,
}) {
final connector = context.read<MeshCoreConnector>();
showMeshSheet(
context,
builder: (sheetContext) {
final l10n = context.l10n;
void importIfNeeded() {
if (!contact.isActive) {
connector.importDiscoveredContact(contact);
}
}
final actions = <Widget>[];
if (contact.type == advTypeChat) {
actions.add(
FilledButton(
onPressed: () {
importIfNeeded();
final unread = connector.getUnreadCountForContactKey(
contact.publicKeyHex,
);
Navigator.pop(sheetContext);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ChatScreen(contact: contact, initialUnreadCount: unread),
),
);
},
child: Text(l10n.contacts_openChat),
),
);
}
if (contact.type == advTypeRepeater) {
actions.add(
FilledButton(
onPressed: () {
importIfNeeded();
Navigator.pop(sheetContext);
showRepeaterLoginDialog(context, contact);
},
child: Text(l10n.map_manageRepeater),
),
);
}
if (contact.type == advTypeRoom) {
actions.add(
FilledButton(
onPressed: () {
importIfNeeded();
Navigator.pop(sheetContext);
showRoomLoginDialog(context, contact);
},
child: Text(l10n.map_joinRoom),
),
);
actions.add(
FilledButton(
onPressed: () {
importIfNeeded();
Navigator.pop(sheetContext);
showRoomLoginDialog(context, contact, manage: true);
},
child: Text(l10n.map_manageServer),
),
);
}
return SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetHeader(
title: contact.name,
subtitle: contact.typeLabel(l10n),
trailing: Icon(
mapNodeTypeIcon(contact.type),
color: mapNodeTypeColor(contact.type),
size: 20,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
NodeInfoRow(
label: l10n.map_path,
value: contact.pathLabel(
l10n,
pathHashByteWidth: connector.pathHashByteWidth,
),
),
if (contact.hasLocation)
NodeInfoRow(
label: l10n.map_location,
value:
'${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}',
)
else if (guessedPosition != null)
NodeInfoRow(
label: l10n.map_estLocation,
value:
'~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}',
),
NodeInfoRow(
label: l10n.map_lastSeen,
value: formatNodeLastSeen(l10n, contact.lastSeen),
),
NodeInfoRow(
label: l10n.map_publicKey,
value: contact.publicKeyHex,
),
const SizedBox(height: 16),
...actions,
],
),
),
],
),
),
);
},
);
}
+126 -40
View File
@@ -9,6 +9,7 @@ import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../theme/mesh_theme.dart';
import 'mesh_ui.dart';
import 'node_info_sheet.dart';
import 'signal_ui.dart';
Contact? _getRepeaterPrefixMatchNearLocation(
@@ -276,53 +277,77 @@ class _SNRIndicatorState extends State<SNRIndicator> {
);
final colorScheme = Theme.of(context).colorScheme;
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
child: Row(
children: [
AvatarCircle(
name: name ?? prefixLabel,
size: 36,
color: colorScheme.onSurfaceVariant,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
return Semantics(
button: true,
hint: l10n.map_details,
child: InkWell(
onTap: () => contact != null
? showNodeInfoSheet(context, contact)
: _showUnknownRepeaterSheet(
context,
repeater,
prefixLabel,
),
child: ConstrainedBox(
constraints: const BoxConstraints(minHeight: 56),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
child: Row(
children: [
Text(
name ?? prefixLabel,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
color: colorScheme.onSurface,
),
AvatarCircle(
name: name ?? prefixLabel,
size: 36,
color: colorScheme.onSurfaceVariant,
),
Row(
children: [
Icon(
Icons.circle,
size: 8,
color: snrColor,
),
const SizedBox(width: 6),
Text(
'${repeater.snr.toStringAsFixed(1)} dB • ${_formatLastUpdated(repeater.lastUpdated)}',
style: MeshTheme.mono(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
name ?? prefixLabel,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
color: colorScheme.onSurface,
),
),
),
],
Row(
children: [
Icon(
Icons.circle,
size: 8,
color: snrColor,
),
const SizedBox(width: 6),
Text(
'${repeater.snr.toStringAsFixed(1)} dB • ${_formatLastUpdated(repeater.lastUpdated)}',
style: MeshTheme.mono(
fontSize: 12,
color: colorScheme
.onSurfaceVariant,
),
),
],
),
],
),
),
const SizedBox(width: 8),
Icon(
Icons.chevron_right,
size: 24,
color: colorScheme.onSurfaceVariant,
),
],
),
),
],
),
),
);
},
@@ -341,4 +366,65 @@ class _SNRIndicatorState extends State<SNRIndicator> {
),
);
}
void _showUnknownRepeaterSheet(
BuildContext context,
DirectRepeater repeater,
String prefixLabel,
) {
showMeshSheet<void>(
context,
builder: (sheetContext) {
final l10n = sheetContext.l10n;
final scheme = Theme.of(sheetContext).colorScheme;
return SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetHeader(
title: prefixLabel,
subtitle: l10n.snrIndicator_unknownRepeater,
trailing: Icon(
mapNodeTypeIcon(advTypeRepeater),
color: mapNodeTypeColor(advTypeRepeater),
size: 20,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
NodeInfoRow(
label: l10n.map_publicKeyPrefix,
value: repeater.pubkeyPrefixHex,
),
NodeInfoRow(
label: l10n.repeater_lastSnr,
value: '${repeater.snr.toStringAsFixed(1)} dB',
),
NodeInfoRow(
label: l10n.map_lastSeen,
value: formatNodeLastSeen(l10n, repeater.lastUpdated),
),
const SizedBox(height: 12),
Text(
l10n.snrIndicator_unknownRepeaterHint,
style: TextStyle(
fontSize: 15,
color: scheme.onSurfaceVariant,
),
),
],
),
),
],
),
),
);
},
);
}
}
+34
View File
@@ -5,6 +5,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -17,6 +19,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -29,6 +33,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -41,6 +47,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -53,6 +61,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -65,6 +75,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -77,6 +89,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -89,6 +103,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -101,6 +117,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -113,6 +131,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -125,6 +145,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -137,6 +159,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -149,6 +173,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -161,6 +187,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -173,6 +201,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -185,6 +215,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",
@@ -197,6 +229,8 @@
"notification_reacted",
"notification_sentGif",
"notification_sentImage",
"snrIndicator_unknownRepeater",
"snrIndicator_unknownRepeaterHint",
"contacts_keyPrefixSemantics",
"networkMap_sourceLocalHint",
"networkMap_sourceOnlineHint",