feat: Version 3.6.3 - Carte IGN, mode boussole, corrections Flutter analyze

Nouvelles fonctionnalités:
- #215 Mode boussole + carte IGN/satellite (Mode terrain)
- #53 Définition zoom maximal pour éviter sur-zoom
- #14 Correction bug F5 déconnexion
- #204 Design couleurs flashy
- #205 Écrans utilisateurs simplifiés

Corrections Flutter analyze:
- Suppression warnings room.g.dart, chat_service.dart, api_service.dart
- 0 error, 0 warning, 30 infos (suggestions de style)

Autres:
- Intégration tuiles IGN Plan et IGN Ortho (geopf.fr)
- flutter_compass pour Android/iOS
- Réorganisation assets store

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 17:46:03 +01:00
parent 232940b1eb
commit 5b6808db25
62 changed files with 1428 additions and 3130 deletions

View File

@@ -8,6 +8,18 @@ import 'package:latlong2/latlong.dart';
import 'package:geosector_app/core/constants/app_keys.dart';
import 'package:geosector_app/core/services/api_service.dart'; // Import du service singleton
/// Enum représentant les différentes sources de tuiles disponibles
enum TileSource {
/// Tuiles Mapbox (par défaut)
mapbox,
/// Tuiles OpenStreetMap
openStreetMap,
/// Tuiles IGN Plan (carte routière française)
ignPlan,
/// Tuiles IGN Ortho Photos (photos aériennes)
ignOrtho,
}
/// Widget de carte réutilisable utilisant Mapbox
///
/// Ce widget encapsule un FlutterMap avec des tuiles Mapbox et fournit
@@ -46,10 +58,14 @@ class MapboxMap extends StatefulWidget {
/// Désactive le drag de la carte
final bool disableDrag;
/// Utiliser OpenStreetMap au lieu de Mapbox (en cas de problème de token)
@Deprecated('Utiliser tileSource à la place')
final bool useOpenStreetMap;
/// Source des tuiles de la carte (Mapbox, OpenStreetMap, IGN Plan, IGN Ortho)
final TileSource tileSource;
const MapboxMap({
super.key,
this.initialPosition = const LatLng(48.1173, -1.6778), // Rennes par défaut
@@ -64,6 +80,7 @@ class MapboxMap extends StatefulWidget {
this.mapStyle,
this.disableDrag = false,
this.useOpenStreetMap = false,
this.tileSource = TileSource.mapbox,
});
@override
@@ -125,7 +142,7 @@ class _MapboxMapState extends State<MapboxMap> {
_cacheInitialized = true;
});
}
debugPrint('MapboxMap: Cache initialisé avec succès pour ${widget.useOpenStreetMap ? "OpenStreetMap" : "Mapbox"}');
debugPrint('MapboxMap: Cache initialisé avec succès');
} catch (e) {
debugPrint('MapboxMap: Erreur lors de l\'initialisation du cache: $e');
// En cas d'erreur, on continue sans cache
@@ -175,30 +192,76 @@ class _MapboxMapState extends State<MapboxMap> {
);
}
/// Retourne l'URL template pour la source de tuiles sélectionnée
String _getTileUrlTemplate() {
// Rétrocompatibilité avec useOpenStreetMap
// ignore: deprecated_member_use_from_same_package
if (widget.useOpenStreetMap && widget.tileSource == TileSource.mapbox) {
return 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
}
switch (widget.tileSource) {
case TileSource.openStreetMap:
return 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
case TileSource.ignPlan:
// IGN Plan IGN v2 - Carte routière française
// Source: https://data.geopf.fr/wmts
return 'https://data.geopf.fr/wmts?'
'REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0'
'&TILEMATRIXSET=PM'
'&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2'
'&STYLE=normal'
'&FORMAT=image/png'
'&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}';
case TileSource.ignOrtho:
// IGN Ortho Photos - Photos aériennes
// Source: https://data.geopf.fr/wmts
return 'https://data.geopf.fr/wmts?'
'REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0'
'&TILEMATRIXSET=PM'
'&LAYER=ORTHOIMAGERY.ORTHOPHOTOS'
'&STYLE=normal'
'&FORMAT=image/jpeg'
'&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}';
case TileSource.mapbox:
default:
// Déterminer l'URL du template de tuiles Mapbox
final String environment = ApiService.instance.getCurrentEnvironment();
final String mapboxToken = AppKeys.getMapboxApiKey(environment);
if (kIsWeb) {
return 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}@2x?access_token=$mapboxToken';
} else {
return 'https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}@2x.png?access_token=$mapboxToken';
}
}
}
/// Retourne le nom de la source de tuiles pour le debug
String _getTileSourceName() {
// ignore: deprecated_member_use_from_same_package
if (widget.useOpenStreetMap && widget.tileSource == TileSource.mapbox) {
return 'OpenStreetMap (legacy)';
}
switch (widget.tileSource) {
case TileSource.mapbox:
return 'Mapbox';
case TileSource.openStreetMap:
return 'OpenStreetMap';
case TileSource.ignPlan:
return 'IGN Plan';
case TileSource.ignOrtho:
return 'IGN Ortho Photos';
}
}
@override
Widget build(BuildContext context) {
String urlTemplate;
if (widget.useOpenStreetMap) {
// Utiliser OpenStreetMap comme alternative
urlTemplate = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
debugPrint('MapboxMap: Utilisation d\'OpenStreetMap');
} else {
// Déterminer l'URL du template de tuiles Mapbox
// Utiliser l'environnement actuel pour obtenir la bonne clé API
final String environment = ApiService.instance.getCurrentEnvironment();
final String mapboxToken = AppKeys.getMapboxApiKey(environment);
// Essayer différentes API Mapbox selon la plateforme
if (kIsWeb) {
// Sur web, on peut utiliser l'API styles
urlTemplate = 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}@2x?access_token=$mapboxToken';
} else {
// Sur mobile, utiliser l'API v4 qui fonctionne mieux avec les tokens standards
// Format: mapbox.streets pour les rues, mapbox.satellite pour satellite
urlTemplate = 'https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}@2x.png?access_token=$mapboxToken';
}
}
final urlTemplate = _getTileUrlTemplate();
debugPrint('MapboxMap: Utilisation de ${_getTileSourceName()}');
// Afficher un indicateur pendant l'initialisation du cache
if (!_cacheInitialized) {