From b67fcdb9ed2ff8d67e6f41aab32098f5e969025b Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Mon, 16 Jun 2025 14:46:51 +0530 Subject: [PATCH] fix: map and image editor related issues --- mobile/lib/ui/map/map_view.dart | 5 ++--- mobile/lib/ui/map/tile/layers.dart | 3 --- .../lib/ui/tools/editor/image_editor_page.dart | 16 +++++++--------- .../location/update_location_data_widget.dart | 1 + 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/mobile/lib/ui/map/map_view.dart b/mobile/lib/ui/map/map_view.dart index 77aa791272..65b3967573 100644 --- a/mobile/lib/ui/map/map_view.dart +++ b/mobile/lib/ui/map/map_view.dart @@ -82,6 +82,7 @@ class _MapViewState extends State { } : null, initialCenter: widget.center, + backgroundColor: const Color.fromARGB(255, 246, 246, 246), minZoom: widget.minZoom, maxZoom: widget.maxZoom, interactionOptions: InteractionOptions( @@ -96,9 +97,7 @@ class _MapViewState extends State { ), ), onPositionChanged: (position, hasGesture) { - if (position.pixelBounds != null) { - onChange(position.bounds!); - } + onChange(position.visibleBounds); }, ), children: [ diff --git a/mobile/lib/ui/map/tile/layers.dart b/mobile/lib/ui/map/tile/layers.dart index 2597dddea2..d3a28928dd 100644 --- a/mobile/lib/ui/map/tile/layers.dart +++ b/mobile/lib/ui/map/tile/layers.dart @@ -29,7 +29,6 @@ class OSMTileLayer extends StatelessWidget { return TileLayer( urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', subdomains: const ['a', 'b', 'c'], - backgroundColor: Colors.transparent, userAgentPackageName: _userAgent, tileProvider: CachedNetworkTileProvider(), ); @@ -46,7 +45,6 @@ class OSMFranceTileLayer extends StatelessWidget { fallbackUrl: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', subdomains: const ['a', 'b', 'c'], tileProvider: CachedNetworkTileProvider(), - backgroundColor: const Color.fromARGB(255, 246, 246, 246), userAgentPackageName: _userAgent, panBuffer: 1, ); @@ -101,7 +99,6 @@ class MapBoxTilesLayer extends StatelessWidget { "https://api.mapbox.com/styles/v1/{mb_user}/{mb_style_id}/tiles/{z}/{x}/{y}?access_token={mb_token}", fallbackUrl: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', subdomains: const ['a', 'b', 'c'], - backgroundColor: Colors.transparent, userAgentPackageName: _userAgent, tileProvider: CachedNetworkTileProvider(), additionalOptions: const { diff --git a/mobile/lib/ui/tools/editor/image_editor_page.dart b/mobile/lib/ui/tools/editor/image_editor_page.dart index b7ba75ea6f..b84edb373b 100644 --- a/mobile/lib/ui/tools/editor/image_editor_page.dart +++ b/mobile/lib/ui/tools/editor/image_editor_page.dart @@ -300,10 +300,8 @@ class _ImageEditorPageState extends State { return; } final EditActionDetails action = state.editAction!; - final double radian = action.rotateAngle; + final degree = action.rotateDegrees.toInt(); - final bool flipHorizontal = action.flipY; - final bool flipVertical = action.flipX; final Uint8List img = state.rawImageData; // ignore: unnecessary_null_comparison @@ -316,11 +314,11 @@ class _ImageEditorPageState extends State { final ImageEditorOption option = ImageEditorOption(); option.addOption(ClipOption.fromRect(rect)); - option.addOption( - FlipOption(horizontal: flipHorizontal, vertical: flipVertical), - ); - if (action.hasRotateAngle) { - option.addOption(RotateOption(radian.toInt())); + if (action.flipY) { + option.addOption(const FlipOption(horizontal: true, vertical: false)); + } + if (action.hasRotateDegrees) { + option.addOption(RotateOption(degree)); } option.addOption(ColorOption.saturation(_saturation!)); @@ -419,7 +417,7 @@ class _ImageEditorPageState extends State { } void rotate(bool right) { - editorKey.currentState?.rotate(right: right); + editorKey.currentState?.rotate(degree: right ? 90 : -90); } Widget _buildSat() { diff --git a/mobile/lib/ui/viewer/location/update_location_data_widget.dart b/mobile/lib/ui/viewer/location/update_location_data_widget.dart index d1cd281bee..d316a2c670 100644 --- a/mobile/lib/ui/viewer/location/update_location_data_widget.dart +++ b/mobile/lib/ui/viewer/location/update_location_data_widget.dart @@ -51,6 +51,7 @@ class _UpdateLocationDataWidgetState extends State { options: MapOptions( interactionOptions: const InteractionOptions(enableMultiFingerGestureRace: true), + backgroundColor: const Color.fromARGB(255, 246, 246, 246), initialZoom: 3, maxZoom: 18.0, minZoom: 2.8,