add option to hide zoom controls and indicator

This commit is contained in:
stopflock
2026-07-25 18:04:54 -05:00
parent dd93ac64b6
commit 3e2c9c5b9e
18 changed files with 232 additions and 70 deletions
+2 -1
View File
@@ -3,7 +3,8 @@
"content": [
"• Catch and correct a couple rare map bounds issues",
"• Prevent queueing a deletion without being logged in",
"• Require a reason for deletion, provide options in a dropdown"
"• Require a reason for deletion, provide options in a dropdown",
"• Add option to hide zoom controls in advanced settings"
]
},
"2.10.3": {
+7
View File
@@ -157,6 +157,8 @@ class AppState extends ChangeNotifier {
UploadMode get uploadMode => _settingsState.uploadMode;
FollowMeMode get followMeMode => _settingsState.followMeMode;
bool get keepScreenAwake => _settingsState.keepScreenAwake;
bool get hideZoomControls => _settingsState.hideZoomControls;
bool get proximityAlertsEnabled => _settingsState.proximityAlertsEnabled;
int get proximityAlertDistance => _settingsState.proximityAlertDistance;
@@ -685,6 +687,11 @@ class AppState extends ChangeNotifier {
await _settingsState.setKeepScreenAwake(enabled);
}
Future<void> setHideZoomControls(bool enabled) async {
await _settingsState.setHideZoomControls(enabled);
}
Future<void> setPauseQueueProcessing(bool enabled) async {
await _settingsState.setPauseQueueProcessing(enabled);
if (!enabled) {
+7 -1
View File
@@ -75,12 +75,18 @@
"advancedSettingsSubtitle": "Leistungs-, Warnungs- und Kachelanbieter-Einstellungen",
"proximityAlerts": "Näherungswarnungen",
"keepScreenAwake": "Bildschirm Aktiv Lassen",
"networkStatusIndicator": "Netzwerkstatus-Anzeige"
"networkStatusIndicator": "Netzwerkstatus-Anzeige",
"hideZoomControls": "Zoom-Steuerung Ausblenden"
},
"keepScreenAwake": {
"title": "Bildschirm während der App-Nutzung aktiv lassen",
"subtitle": "Verhindert, dass sich der Bildschirm während der Nutzung der App automatisch ausschaltet"
},
"hideZoomControls": {
"title": "Zoom-Steuerung ausblenden",
"subtitle": "Blendet die +/- Zoom-Schaltflächen und die Zoomstufen-Anzeige aus. Sie können weiterhin mit Fingergesten zoomen."
},
"proximityAlerts": {
"getNotified": "Benachrichtigung erhalten beim Annähern an Überwachungsgeräte",
"batteryUsage": "Verbraucht zusätzlich Batterie für kontinuierliche Standortüberwachung",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Performance, alerts, and tile provider settings",
"proximityAlerts": "Proximity Alerts",
"networkStatusIndicator": "Network Status Indicator",
"keepScreenAwake": "Keep Screen Awake"
"keepScreenAwake": "Keep Screen Awake",
"hideZoomControls": "Hide Zoom Controls"
},
"keepScreenAwake": {
"title": "Keep screen awake while using app",
"subtitle": "Prevents the screen from turning off automatically while using the app"
},
"hideZoomControls": {
"title": "Hide zoom controls",
"subtitle": "Hide the +/- zoom buttons and zoom level indicator. You can still zoom with pinch gestures."
},
"proximityAlerts": {
"getNotified": "Get notified when approaching surveillance devices",
"batteryUsage": "Uses extra battery for continuous location monitoring",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Configuración de rendimiento, alertas y proveedores de teselas",
"proximityAlerts": "Alertas de Proximidad",
"keepScreenAwake": "Mantener la Pantalla Encendida",
"networkStatusIndicator": "Indicador de Estado de Red"
"networkStatusIndicator": "Indicador de Estado de Red",
"hideZoomControls": "Ocultar Controles de Zoom"
},
"keepScreenAwake": {
"title": "Mantener la pantalla encendida mientras se usa la app",
"subtitle": "Evita que la pantalla se apague automáticamente mientras se usa la app"
},
"hideZoomControls": {
"title": "Ocultar controles de zoom",
"subtitle": "Oculta los botones de zoom +/- y el indicador de nivel de zoom. Aún puedes hacer zoom con gestos de pellizco."
},
"proximityAlerts": {
"getNotified": "Recibe notificaciones al acercarte a dispositivos de vigilancia",
"batteryUsage": "Usa batería extra para monitoreo continuo de ubicación",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Paramètres de performance, alertes et fournisseurs de tuiles",
"proximityAlerts": "Alertes de Proximité",
"keepScreenAwake": "Maintenir l'écran Allumé",
"networkStatusIndicator": "Indicateur de Statut Réseau"
"networkStatusIndicator": "Indicateur de Statut Réseau",
"hideZoomControls": "Masquer les Contrôles de Zoom"
},
"keepScreenAwake": {
"title": "Maintenir l'écran allumé lors de l'utilisation de l'application",
"subtitle": "Empêche l'écran de s'éteindre automatiquement pendant l'utilisation de l'application"
},
"hideZoomControls": {
"title": "Masquer les contrôles de zoom",
"subtitle": "Masque les boutons de zoom +/- et l'indicateur de niveau de zoom. Vous pouvez toujours zoomer avec des gestes de pincement."
},
"proximityAlerts": {
"getNotified": "Recevoir des notifications en s'approchant de dispositifs de surveillance",
"batteryUsage": "Utilise de la batterie supplémentaire pour la surveillance continue de la localisation",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Impostazioni di prestazioni, avvisi e fornitori di tessere",
"proximityAlerts": "Avvisi di Prossimità",
"keepScreenAwake": "Mantieni lo Schermo Attivo",
"networkStatusIndicator": "Indicatore di Stato di Rete"
"networkStatusIndicator": "Indicatore di Stato di Rete",
"hideZoomControls": "Nascondi Controlli Zoom"
},
"keepScreenAwake": {
"title": "Mantieni lo schermo attivo durante l'utilizzo dell'app",
"subtitle": "Impedisce allo schermo di spegnersi automaticamente durante l'utilizzo dell'app"
},
"hideZoomControls": {
"title": "Nascondi i controlli dello zoom",
"subtitle": "Nasconde i pulsanti di zoom +/- e l'indicatore del livello di zoom. Puoi ancora usare i gesti di pizzico per lo zoom."
},
"proximityAlerts": {
"getNotified": "Ricevi notifiche quando ti avvicini a dispositivi di sorveglianza",
"batteryUsage": "Utilizza batteria extra per il monitoraggio continuo della posizione",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Prestaties, waarschuwingen en tile provider instellingen",
"proximityAlerts": "Nabijheids Waarschuwingen",
"keepScreenAwake": "Scherm Actief Houden",
"networkStatusIndicator": "Netwerk Status Indicator"
"networkStatusIndicator": "Netwerk Status Indicator",
"hideZoomControls": "Zoomknoppen Verbergen"
},
"keepScreenAwake": {
"title": "Houd het scherm actief tijdens het gebruik van de app",
"subtitle": "Voorkomt dat het scherm automatisch uitschakelt tijdens het gebruik van de app"
},
"hideZoomControls": {
"title": "Zoomknoppen verbergen",
"subtitle": "Verbergt de +/- zoomknoppen en de zoomniveau-indicator. U kunt nog steeds zoomen met knijpgebaren."
},
"proximityAlerts": {
"getNotified": "Krijg meldingen wanneer u surveillance apparaten nadert",
"batteryUsage": "Gebruikt extra batterij voor continue locatie monitoring",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Wydajność, alerty i ustawienia dostawców kafelków",
"proximityAlerts": "Alerty Bliskości",
"keepScreenAwake": "Nie Wygaszaj Ekranu",
"networkStatusIndicator": "Wskaźnik Stanu Sieci"
"networkStatusIndicator": "Wskaźnik Stanu Sieci",
"hideZoomControls": "Ukryj Kontrolki Zoomu"
},
"keepScreenAwake": {
"title": "Nie wygaszaj ekranu podczas korzystania z aplikacji",
"subtitle": "Zapobiega automatycznemu wygaszaniu ekranu podczas korzystania z aplikacji"
},
"hideZoomControls": {
"title": "Ukryj kontrolki zoomu",
"subtitle": "Ukrywa przyciski zoomu +/- oraz wskaźnik poziomu powiększenia. Nadal możesz powiększać za pomocą gestów szczypania."
},
"proximityAlerts": {
"getNotified": "Otrzymuj powiadomienia przy zbliżaniu się do urządzeń nadzoru",
"batteryUsage": "Używa dodatkowej baterii do ciągłego monitorowania lokalizacji",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Configurações de desempenho, alertas e provedores de mapas",
"proximityAlerts": "Alertas de Proximidade",
"keepScreenAwake": "Manter Ecrã Ativa",
"networkStatusIndicator": "Indicador de Status de Rede"
"networkStatusIndicator": "Indicador de Status de Rede",
"hideZoomControls": "Ocultar Controlos de Zoom"
},
"keepScreenAwake": {
"title": "Manter o ecrã ativo durante o uso do app",
"subtitle": "Impede que o ecrã se desligue automaticamente enquanto a app estiver em uso"
},
"hideZoomControls": {
"title": "Ocultar controlos de zoom",
"subtitle": "Oculta os botões de zoom +/- e o indicador de nível de zoom. Ainda pode ampliar com gestos de pinça."
},
"proximityAlerts": {
"getNotified": "Receba notificações ao se aproximar de dispositivos de vigilância",
"batteryUsage": "Usa bateria extra para monitoramento contínuo de localização",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Performans, uyarılar ve döşeme sağlayıcı ayarları",
"proximityAlerts": "Yakınlık Uyarıları",
"keepScreenAwake": "Ekranı Açık Tut",
"networkStatusIndicator": "Ağ Durumu Göstergesi"
"networkStatusIndicator": "Ağ Durumu Göstergesi",
"hideZoomControls": "Yakınlaştırma Kontrollerini Gizle"
},
"keepScreenAwake": {
"title": "Uygulamayı kullanırken ekranı açık tut",
"subtitle": "Uygulamayı kullanırken ekranın otomatik olarak kapanmasını engeller"
},
"hideZoomControls": {
"title": "Yakınlaştırma kontrollerini gizle",
"subtitle": "+/- yakınlaştırma düğmelerini ve yakınlaştırma seviyesi göstergesini gizler. Yine de kıstırma hareketleriyle yakınlaştırabilirsiniz."
},
"proximityAlerts": {
"getNotified": "Gözetleme cihazlarına yaklaşırken bildirim al",
"batteryUsage": "Sürekli konum izleme için ekstra batarya kullanır",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "Продуктивність, сповіщення та налаштування постачальників плиток",
"proximityAlerts": "Сповіщення Про Близькість",
"keepScreenAwake": "Тримати екран активним",
"networkStatusIndicator": "Індикатор Стану Мережі"
"networkStatusIndicator": "Індикатор Стану Мережі",
"hideZoomControls": "Приховати Елементи Керування Масштабом"
},
"keepScreenAwake": {
"title": "Тримати екран активним під час використання програми",
"subtitle": "Запобігає автоматичному вимкненню екрана під час використання програми"
},
"hideZoomControls": {
"title": "Приховати елементи керування масштабом",
"subtitle": "Приховує кнопки масштабування +/- та індикатор рівня масштабу. Ви все ще можете масштабувати жестами."
},
"proximityAlerts": {
"getNotified": "Отримувати сповіщення при наближенні до пристроїв спостереження",
"batteryUsage": "Використовує додаткову батарею для безперервного моніторингу місцезнаходження",
+7 -1
View File
@@ -112,12 +112,18 @@
"advancedSettingsSubtitle": "性能、警报和地图提供商设置",
"proximityAlerts": "邻近警报",
"keepScreenAwake": "保持屏幕常亮",
"networkStatusIndicator": "网络状态指示器"
"networkStatusIndicator": "网络状态指示器",
"hideZoomControls": "隐藏缩放控件"
},
"keepScreenAwake": {
"title": "使用应用时保持屏幕常亮",
"subtitle": "防止在使用应用期间屏幕自动熄灭"
},
"hideZoomControls": {
"title": "隐藏缩放控件",
"subtitle": "隐藏 +/- 缩放按钮和缩放级别指示器。您仍然可以使用捏合手势进行缩放。"
},
"proximityAlerts": {
"getNotified": "接近监控设备时接收通知",
"batteryUsage": "使用额外电量进行连续位置监控",
@@ -4,6 +4,8 @@ import 'settings/sections/proximity_alerts_section.dart';
import 'settings/sections/suspected_locations_section.dart';
import 'settings/sections/tile_provider_section.dart';
import 'settings/sections/keep_screen_awake_section.dart';
import 'settings/sections/hide_zoom_controls_section.dart';
import '../services/localization_service.dart';
class AdvancedSettingsScreen extends StatelessWidget {
@@ -35,6 +37,9 @@ class AdvancedSettingsScreen extends StatelessWidget {
Divider(),
KeepScreenAwakeSection(),
Divider(),
HideZoomControlsSection(),
Divider(),
// NetworkStatusSection(), // Commented out - network status indicator now defaults to enabled
// Divider(),
TileProviderSection(),
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../app_state.dart';
import '../../../services/localization_service.dart';
class HideZoomControlsSection extends StatelessWidget {
const HideZoomControlsSection({super.key});
@override
Widget build(BuildContext context) {
// Standard Pattern: Use AnimatedBuilder to respond to language/localization changes
return AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) {
final locService = LocalizationService.instance;
final appState = context.watch<AppState>();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Bold Section Header (matches Keep Screen Awake, Proximity, etc.)
Text(
locService.t('settings.hideZoomControls'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
// The Functional Toggle
SwitchListTile(
contentPadding: EdgeInsets.zero, // Aligns switch text with the bold header
title: Text(locService.t('hideZoomControls.title')),
subtitle: Text(
locService.t('hideZoomControls.subtitle'),
style: const TextStyle(fontSize: 12),
),
value: appState.hideZoomControls,
onChanged: (bool value) {
appState.setHideZoomControls(value);
},
),
],
);
},
);
}
}
+20
View File
@@ -40,10 +40,13 @@ class SettingsState extends ChangeNotifier {
static const String _navigationAvoidanceDistancePrefsKey = 'navigation_avoidance_distance';
static const String _distanceUnitPrefsKey = 'distance_unit';
static const String _keepScreenAwakePrefsKey = 'keep_screen_awake';
static const String _hideZoomControlsPrefsKey = 'hide_zoom_controls';
bool _offlineMode = false;
bool _pauseQueueProcessing = false;
bool _keepScreenAwake = false;
bool _hideZoomControls = false;
int _maxNodes = kDefaultMaxNodes;
// Default must account for missing secrets (preview builds) even before init() runs
UploadMode _uploadMode = (kEnableDevelopmentModes || !kHasOsmSecrets) ? UploadMode.simulate : UploadMode.production;
@@ -68,7 +71,9 @@ class SettingsState extends ChangeNotifier {
bool get networkStatusIndicatorEnabled => _networkStatusIndicatorEnabled;
int get suspectedLocationMinDistance => _suspectedLocationMinDistance;
bool get keepScreenAwake => _keepScreenAwake;
bool get hideZoomControls => _hideZoomControls;
List<TileProvider> get tileProviders => List.unmodifiable(_tileProviders);
String get selectedTileTypeId => _selectedTileTypeId;
int get navigationAvoidanceDistance => _navigationAvoidanceDistance;
DistanceUnit get distanceUnit => _distanceUnit;
@@ -144,7 +149,11 @@ class SettingsState extends ChangeNotifier {
// Load keep screen awake setting
_keepScreenAwake = prefs.getBool(_keepScreenAwakePrefsKey) ?? false;
// Load hide zoom controls setting
_hideZoomControls = prefs.getBool(_hideZoomControlsPrefsKey) ?? false;
// Load upload mode (including migration from old test_mode bool)
if (prefs.containsKey(_uploadModePrefsKey)) {
final idx = prefs.getInt(_uploadModePrefsKey) ?? 0;
@@ -413,6 +422,17 @@ class SettingsState extends ChangeNotifier {
}
}
/// Set hide zoom controls enabled/disabled
Future<void> setHideZoomControls(bool enabled) async {
if (_hideZoomControls != enabled) {
_hideZoomControls = enabled;
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(_hideZoomControlsPrefsKey, enabled);
notifyListeners();
}
}
/// Set distance for avoidance of nodes during navigation
Future<void> setNavigationAvoidanceDistance(int distance) async {
if (_navigationAvoidanceDistance != distance) {
+65 -57
View File
@@ -17,6 +17,7 @@ class MapOverlays extends StatelessWidget {
final EditNodeSession? editSession;
final String? attribution; // Attribution for current tile provider
final VoidCallback? onSearchPressed; // Callback for search button
final bool hideZoomControls; // Hide zoom indicator + zoom in/out buttons
const MapOverlays({
super.key,
required this.mapController,
@@ -25,8 +26,10 @@ class MapOverlays extends StatelessWidget {
this.editSession,
this.attribution,
this.onSearchPressed,
this.hideZoomControls = false,
});
/// Show full attribution text in a dialog with license link.
void _showAttributionDialog(BuildContext context, String attribution) {
final locService = LocalizationService.instance;
@@ -138,35 +141,37 @@ class MapOverlays extends StatelessWidget {
),
// Zoom indicator, positioned relative to button bar with left safe area
Positioned(
left: leftPositionWithSafeArea(10, safeArea),
bottom: bottomPositionFromButtonBar(kZoomIndicatorSpacingAboveButtonBar, safeArea.bottom),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.52),
borderRadius: BorderRadius.circular(7),
),
child: Builder(
builder: (context) {
double zoom = 15.0; // fallback
try {
zoom = mapController.mapController.camera.zoom;
} catch (_) {
// Map controller not ready yet
}
return Text(
'Zoom: ${zoom.toStringAsFixed(2)}',
style: const TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600,
),
);
},
if (!hideZoomControls)
Positioned(
left: leftPositionWithSafeArea(10, safeArea),
bottom: bottomPositionFromButtonBar(kZoomIndicatorSpacingAboveButtonBar, safeArea.bottom),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.52),
borderRadius: BorderRadius.circular(7),
),
child: Builder(
builder: (context) {
double zoom = 15.0; // fallback
try {
zoom = mapController.mapController.camera.zoom;
} catch (_) {
// Map controller not ready yet
}
return Text(
'Zoom: ${zoom.toStringAsFixed(2)}',
style: const TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600,
),
);
},
),
),
),
),
// Attribution overlay, positioned relative to button bar with left safe area
if (attribution != null)
@@ -228,37 +233,40 @@ class MapOverlays extends StatelessWidget {
// Layer selector button
const LayerSelectorButton(),
const SizedBox(height: 8),
// Zoom in button
FloatingActionButton(
mini: true,
heroTag: "zoom_in",
onPressed: () {
try {
final zoom = mapController.mapController.camera.zoom;
mapController.mapController.move(mapController.mapController.camera.center, zoom + 1);
} catch (_) {
// Map controller not ready yet
}
},
child: const Icon(Icons.add),
),
const SizedBox(height: 8),
// Zoom out button
FloatingActionButton(
mini: true,
heroTag: "zoom_out",
onPressed: () {
try {
final zoom = mapController.mapController.camera.zoom;
mapController.mapController.move(mapController.mapController.camera.center, zoom - 1);
} catch (_) {
// Map controller not ready yet
}
},
child: const Icon(Icons.remove),
),
if (!hideZoomControls) ...[
const SizedBox(height: 8),
// Zoom in button
FloatingActionButton(
mini: true,
heroTag: "zoom_in",
onPressed: () {
try {
final zoom = mapController.mapController.camera.zoom;
mapController.mapController.move(mapController.mapController.camera.center, zoom + 1);
} catch (_) {
// Map controller not ready yet
}
},
child: const Icon(Icons.add),
),
const SizedBox(height: 8),
// Zoom out button
FloatingActionButton(
mini: true,
heroTag: "zoom_out",
onPressed: () {
try {
final zoom = mapController.mapController.camera.zoom;
mapController.mapController.move(mapController.mapController.camera.center, zoom - 1);
} catch (_) {
// Map controller not ready yet
}
},
child: const Icon(Icons.remove),
),
],
],
);
},
),
+10 -1
View File
@@ -596,17 +596,24 @@ class MapViewState extends State<MapView> {
Builder(
builder: (context) {
final safeArea = MediaQuery.of(context).padding;
// When zoom controls (and the zoom level indicator) are hidden,
// shift the scale bar down into the indicator's old slot so we
// don't leave a weird empty gap above the attribution text.
final scaleBarSpacing = appState.hideZoomControls
? kZoomIndicatorSpacingAboveButtonBar
: kScaleBarSpacingAboveButtonBar;
return CustomScaleBar(
alignment: Alignment.bottomLeft,
padding: EdgeInsets.only(
left: leftPositionWithSafeArea(8, safeArea),
bottom: bottomPositionFromButtonBar(kScaleBarSpacingAboveButtonBar, safeArea.bottom),
bottom: bottomPositionFromButtonBar(scaleBarSpacing, safeArea.bottom),
),
maxWidthPx: 120,
barHeight: 8,
);
},
),
],
),
),
@@ -620,8 +627,10 @@ class MapViewState extends State<MapView> {
editSession: editSession,
attribution: appState.selectedTileType?.attribution,
onSearchPressed: widget.onSearchPressed,
hideZoomControls: appState.hideZoomControls,
),
// Node limit indicator (top-left) - shown when limit is active
Builder(
builder: (context) {