From 23b7586e25eff7bd85f106c7162a4952b52560d4 Mon Sep 17 00:00:00 2001 From: stopflock Date: Fri, 26 Sep 2025 15:40:30 -0500 Subject: [PATCH] tag node -> add node, better element offsets, fix splash background on iOS --- lib/dev_config.dart | 19 +++++++++++++------ lib/localizations/de.json | 2 +- lib/localizations/en.json | 2 +- lib/localizations/es.json | 2 +- lib/localizations/fr.json | 2 +- lib/main.dart | 2 +- lib/screens/home_screen.dart | 4 ++-- lib/widgets/download_area_dialog.dart | 3 +++ lib/widgets/map/map_overlays.dart | 12 ++++++------ lib/widgets/map_view.dart | 7 +++++-- 10 files changed, 34 insertions(+), 21 deletions(-) diff --git a/lib/dev_config.dart b/lib/dev_config.dart index 2b122c6..e62a8fc 100644 --- a/lib/dev_config.dart +++ b/lib/dev_config.dart @@ -13,13 +13,20 @@ const double kDirectionConeHalfAngle = 30.0; // degrees const double kDirectionConeBaseLength = 0.001; // multiplier const Color kDirectionConeColor = Color(0xFF000000); // FOV cone color -// Margin (bottom) for positioning the floating bottom button bar -const double kBottomButtonBarMargin = 4.0; +// Bottom button bar positioning +const double kBottomButtonBarOffset = 4.0; // Distance from screen bottom (above safe area) +const double kButtonBarHeight = 60.0; // Button height (48) + padding (12) -// Map overlay (attribution, scale bar, zoom) vertical offset from bottom edge -const double kAttributionBottomOffset = 110.0; -const double kZoomIndicatorBottomOffset = 142.0; -const double kScaleBarBottomOffset = 170.0; +// Map overlay spacing relative to button bar top +const double kAttributionSpacingAboveButtonBar = 10.0; // Attribution above button bar top +const double kZoomIndicatorSpacingAboveButtonBar = 40.0; // Zoom indicator above button bar top +const double kScaleBarSpacingAboveButtonBar = 70.0; // Scale bar above button bar top +const double kZoomControlsSpacingAboveButtonBar = 20.0; // Zoom controls above button bar top + +// Helper to calculate bottom position relative to button bar +double bottomPositionFromButtonBar(double spacingAboveButtonBar, double safeAreaBottom) { + return safeAreaBottom + kBottomButtonBarOffset + kButtonBarHeight + spacingAboveButtonBar; +} // Add Camera icon vertical offset (no offset needed since circle is centered) const double kAddPinYOffset = 0.0; diff --git a/lib/localizations/de.json b/lib/localizations/de.json index 66bfc73..e005ad3 100644 --- a/lib/localizations/de.json +++ b/lib/localizations/de.json @@ -6,7 +6,7 @@ "title": "DeFlock" }, "actions": { - "tagNode": "Knoten Markieren", + "tagNode": "Neuer Knoten", "download": "Herunterladen", "settings": "Einstellungen", "edit": "Bearbeiten", diff --git a/lib/localizations/en.json b/lib/localizations/en.json index 3dc0a8e..4b18296 100644 --- a/lib/localizations/en.json +++ b/lib/localizations/en.json @@ -6,7 +6,7 @@ "title": "DeFlock" }, "actions": { - "tagNode": "Tag Node", + "tagNode": "New Node", "download": "Download", "settings": "Settings", "edit": "Edit", diff --git a/lib/localizations/es.json b/lib/localizations/es.json index f5dbed0..0cb29e8 100644 --- a/lib/localizations/es.json +++ b/lib/localizations/es.json @@ -6,7 +6,7 @@ "title": "DeFlock" }, "actions": { - "tagNode": "Etiquetar Nodo", + "tagNode": "Nuevo Nodo", "download": "Descargar", "settings": "Configuración", "edit": "Editar", diff --git a/lib/localizations/fr.json b/lib/localizations/fr.json index eb4bbe8..4016921 100644 --- a/lib/localizations/fr.json +++ b/lib/localizations/fr.json @@ -6,7 +6,7 @@ "title": "DeFlock" }, "actions": { - "tagNode": "Marquer Nœud", + "tagNode": "Nouveau Nœud", "download": "Télécharger", "settings": "Paramètres", "edit": "Modifier", diff --git a/lib/main.dart b/lib/main.dart index 4e67496..54a3a33 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ Future main() async { // You can customize this splash/loading screen as needed return MaterialApp( home: Scaffold( - backgroundColor: Color(0xFF202020), + backgroundColor: Color(0xFF152131), body: Center( child: Image.asset( 'assets/app_icon.png', diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 8ac9e09..3d59244 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -201,7 +201,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { alignment: Alignment.bottomCenter, child: Padding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + kBottomButtonBarMargin, + bottom: MediaQuery.of(context).padding.bottom + kBottomButtonBarOffset, left: 8, right: 8, ), @@ -217,7 +217,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ) ], ), - margin: EdgeInsets.only(bottom: kBottomButtonBarMargin), + margin: EdgeInsets.only(bottom: kBottomButtonBarOffset), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), child: Row( children: [ diff --git a/lib/widgets/download_area_dialog.dart b/lib/widgets/download_area_dialog.dart index 1b20078..8e8c9b1 100644 --- a/lib/widgets/download_area_dialog.dart +++ b/lib/widgets/download_area_dialog.dart @@ -64,6 +64,9 @@ class _DownloadAreaDialogState extends State { final nTiles = computeTileList(bounds, minZoom, maxZoom).length; final totalMb = (nTiles * kTileEstimateKb) / 1024.0; + // Debug logging to check calculation + debugPrint('[DownloadDialog] Tiles: $nTiles, EstimateKb: $kTileEstimateKb, Total MB: $totalMb'); + setState(() { _minZoom = minZoom; _maxPossibleZoom = maxPossibleZoom; diff --git a/lib/widgets/map/map_overlays.dart b/lib/widgets/map/map_overlays.dart index a67334d..417f40a 100644 --- a/lib/widgets/map/map_overlays.dart +++ b/lib/widgets/map/map_overlays.dart @@ -57,10 +57,10 @@ class MapOverlays extends StatelessWidget { ), ), - // Zoom indicator, positioned above scale bar + // Zoom indicator, positioned relative to button bar Positioned( left: 10, - bottom: kZoomIndicatorBottomOffset, + bottom: bottomPositionFromButtonBar(kZoomIndicatorSpacingAboveButtonBar, MediaQuery.of(context).padding.bottom), child: Container( padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2), decoration: BoxDecoration( @@ -83,10 +83,10 @@ class MapOverlays extends StatelessWidget { ), ), - // Attribution overlay + // Attribution overlay, positioned relative to button bar if (attribution != null) Positioned( - bottom: kAttributionBottomOffset, + bottom: bottomPositionFromButtonBar(kAttributionSpacingAboveButtonBar, MediaQuery.of(context).padding.bottom), left: 10, child: Container( decoration: BoxDecoration( @@ -104,9 +104,9 @@ class MapOverlays extends StatelessWidget { ), ), - // Zoom and layer controls (bottom-right) + // Zoom and layer controls (bottom-right), positioned relative to button bar Positioned( - bottom: 80, + bottom: bottomPositionFromButtonBar(kZoomControlsSpacingAboveButtonBar, MediaQuery.of(context).padding.bottom), right: 16, child: Column( children: [ diff --git a/lib/widgets/map_view.dart b/lib/widgets/map_view.dart index 0d022a7..2b73292 100644 --- a/lib/widgets/map_view.dart +++ b/lib/widgets/map_view.dart @@ -332,10 +332,13 @@ class MapViewState extends State { selectedTileType: appState.selectedTileType, ), cameraLayers, - // Built-in scale bar from flutter_map + // Built-in scale bar from flutter_map, positioned relative to button bar Scalebar( alignment: Alignment.bottomLeft, - padding: EdgeInsets.only(left: 8, bottom: kScaleBarBottomOffset), // from dev_config + padding: EdgeInsets.only( + left: 8, + bottom: bottomPositionFromButtonBar(kScaleBarSpacingAboveButtonBar, MediaQuery.of(context).padding.bottom) + ), textStyle: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), lineColor: Colors.black, strokeWidth: 3,