mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-16 22:00:50 +10:00
Refactor map legend and filtering logic for contacts with location, to show count of active markers. (#203)
This commit is contained in:
@@ -488,7 +488,8 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
),
|
),
|
||||||
if (!_isBuildingPathTrace)
|
if (!_isBuildingPathTrace)
|
||||||
_buildLegend(
|
_buildLegend(
|
||||||
contactsWithLocation.length,
|
contactsWithLocation,
|
||||||
|
settings,
|
||||||
sharedMarkers.length,
|
sharedMarkers.length,
|
||||||
),
|
),
|
||||||
if (_isBuildingPathTrace) _buildPathTraceOverlay(),
|
if (_isBuildingPathTrace) _buildPathTraceOverlay(),
|
||||||
@@ -524,13 +525,17 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
if (!contact.hasLocation) continue;
|
if (!contact.hasLocation) continue;
|
||||||
|
|
||||||
// Apply node type filters
|
// Apply node type filters
|
||||||
if (contact.type == advTypeRepeater && !settings.mapShowRepeaters) {
|
if (contact.type == advTypeRepeater &&
|
||||||
|
(!settings.mapShowRepeaters && !_isBuildingPathTrace)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (contact.type == advTypeChat &&
|
||||||
|
!(settings.mapShowChatNodes && !_isBuildingPathTrace)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (contact.type == advTypeChat && !settings.mapShowChatNodes) continue;
|
|
||||||
if (contact.type != advTypeChat &&
|
if (contact.type != advTypeChat &&
|
||||||
contact.type != advTypeRepeater &&
|
contact.type != advTypeRepeater &&
|
||||||
!settings.mapShowOtherNodes) {
|
(!settings.mapShowOtherNodes && !_isBuildingPathTrace)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +658,26 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildLegend(int nodeCount, int markerCount) {
|
Widget _buildLegend(
|
||||||
|
List<Contact> contactsWithLocation,
|
||||||
|
settings,
|
||||||
|
int markerCount,
|
||||||
|
) {
|
||||||
|
int nodeCount = 0;
|
||||||
|
for (final contact in contactsWithLocation) {
|
||||||
|
// Apply node type filters
|
||||||
|
if (contact.type == advTypeRepeater && !settings.mapShowRepeaters) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (contact.type == advTypeChat && !settings.mapShowChatNodes) continue;
|
||||||
|
if (contact.type != advTypeChat &&
|
||||||
|
contact.type != advTypeRepeater &&
|
||||||
|
!settings.mapShowOtherNodes) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
nodeCount++;
|
||||||
|
}
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: 16,
|
top: 16,
|
||||||
right: 16,
|
right: 16,
|
||||||
|
|||||||
Reference in New Issue
Block a user