Get rid of double cache, filesystem checking for every tile fetch, swap out http interception for a fluttermap tileprovider that calls map_data, fix node rendering limit

This commit is contained in:
stopflock
2025-11-28 21:48:17 -06:00
parent 153377e9e6
commit df0377b41f
19 changed files with 228 additions and 45 deletions

View File

@@ -610,14 +610,24 @@ class MapViewState extends State<MapView> {
MarkerLayer(markers: [...suspectedLocationMarkers, ...markers, ...centerMarkers]),
// Node limit indicator (top-left) - shown when limit is active
NodeLimitIndicator(
isActive: isLimitActive,
renderedCount: nodesToRender.length,
totalCount: isLimitActive ? allNodes.where((node) {
return (node.coord.latitude != 0 || node.coord.longitude != 0) &&
node.coord.latitude.abs() <= 90 &&
node.coord.longitude.abs() <= 180;
}).length : 0,
Builder(
builder: (context) {
final appState = context.read<AppState>();
// Add search bar offset when search bar is visible
final searchBarOffset = (!appState.offlineMode && appState.isInSearchMode) ? 60.0 : 0.0;
return NodeLimitIndicator(
isActive: isLimitActive,
renderedCount: nodesToRender.length,
totalCount: isLimitActive ? allNodes.where((node) {
return (node.coord.latitude != 0 || node.coord.longitude != 0) &&
node.coord.latitude.abs() <= 90 &&
node.coord.longitude.abs() <= 180;
}).length : 0,
top: 8.0 + searchBarOffset,
left: 8.0,
);
},
),
],
);
@@ -774,7 +784,18 @@ class MapViewState extends State<MapView> {
// Network status indicator (top-left) - conditionally shown
if (appState.networkStatusIndicatorEnabled)
const NetworkStatusIndicator(),
Builder(
builder: (context) {
// Calculate position based on node limit indicator presence and search bar
final searchBarOffset = (!appState.offlineMode && appState.isInSearchMode) ? 60.0 : 0.0;
final nodeLimitOffset = isLimitActive ? 48.0 : 0.0; // Height of node limit indicator + spacing
return NetworkStatusIndicator(
top: 8.0 + searchBarOffset + nodeLimitOffset,
left: 8.0,
);
},
),
// Proximity alert banner (top)
ProximityAlertBanner(

View File

@@ -4,7 +4,14 @@ import '../services/network_status.dart';
import '../services/localization_service.dart';
class NetworkStatusIndicator extends StatelessWidget {
const NetworkStatusIndicator({super.key});
final double top;
final double left;
const NetworkStatusIndicator({
super.key,
this.top = 56.0,
this.left = 8.0,
});
@override
Widget build(BuildContext context) {
@@ -61,8 +68,8 @@ class NetworkStatusIndicator extends StatelessWidget {
}
return Positioned(
top: 56, // Position below node limit indicator when present
left: 8,
top: top, // Position dynamically based on other indicators
left: left,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(

View File

@@ -5,12 +5,16 @@ class NodeLimitIndicator extends StatelessWidget {
final bool isActive;
final int renderedCount;
final int totalCount;
final double top;
final double left;
const NodeLimitIndicator({
super.key,
required this.isActive,
required this.renderedCount,
required this.totalCount,
this.top = 8.0,
this.left = 8.0,
});
@override
@@ -25,8 +29,8 @@ class NodeLimitIndicator extends StatelessWidget {
.replaceAll('{total}', totalCount.toString());
return Positioned(
top: 8, // Position at top-left of map area
left: 8,
top: top, // Position at top-left of map area
left: left,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(

View File

@@ -37,6 +37,20 @@ class NodeTagSheet extends StatelessWidget {
node.tags['_pending_deletion'] != 'true');
void _openEditSheet() {
// Check if node limit is active and warn user
if (isNodeLimitActive) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
locService.t('nodeLimitIndicator.editingDisabledMessage')
),
duration: const Duration(seconds: 4),
behavior: SnackBarBehavior.floating,
),
);
return;
}
if (onEditPressed != null) {
onEditPressed!(); // Use callback if provided
} else {
@@ -206,7 +220,7 @@ class NodeTagSheet extends StatelessWidget {
children: [
if (isEditable) ...[
ElevatedButton.icon(
onPressed: isNodeLimitActive ? null : _openEditSheet,
onPressed: _openEditSheet,
icon: const Icon(Icons.edit, size: 18),
label: Text(locService.edit),
style: ElevatedButton.styleFrom(