From 0b9a14062049d40561259ca4e1632882f749ade2 Mon Sep 17 00:00:00 2001 From: Dayron Date: Mon, 6 Oct 2025 15:14:35 +0200 Subject: [PATCH] Update Gradle configuration to use Java 17 and enhance map UI with search functionality --- android/app/build.gradle.kts | 6 +- lib/components/map/map_content.dart | 105 ++++++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 9 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 9bd9a0b..746a639 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -11,12 +11,12 @@ android { ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.toString() + jvmTarget = JavaVersion.VERSION_17.toString() } defaultConfig { diff --git a/lib/components/map/map_content.dart b/lib/components/map/map_content.dart index 2ba4185..93e8747 100644 --- a/lib/components/map/map_content.dart +++ b/lib/components/map/map_content.dart @@ -9,13 +9,106 @@ class MapContent extends StatefulWidget { } class _MapContentState extends State { - final LatLng _initialPosition = LatLng(48.8566, 2.3522); // Paris + final LatLng _initialPosition = const LatLng(48.8566, 2.3522); // Paris + final TextEditingController _searchController = TextEditingController(); + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + void _searchLocation() { + // TODO: Implémenter la logique de recherche + final searchQuery = _searchController.text.trim(); + if (searchQuery.isNotEmpty) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Recherche de: $searchQuery')), + ); + } + } @override Widget build(BuildContext context) { - return GoogleMap(initialCameraPosition: CameraPosition( - target: _initialPosition, - zoom: 12, - )); + return Scaffold( + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + // Champ de recherche + TextField( + controller: _searchController, + decoration: InputDecoration( + hintText: 'Rechercher un lieu...', + prefixIcon: const Icon(Icons.search), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + ), + filled: true, + fillColor: Colors.white, + ), + onSubmitted: (_) => _searchLocation(), + ), + + const SizedBox(height: 8), + + // Bouton chercher + SizedBox( + width: double.infinity, + height: 48, + child: ElevatedButton( + onPressed: _searchLocation, + style: ElevatedButton.styleFrom( + backgroundColor: Theme.of(context).colorScheme.primary, + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), + ), + child: const Text( + 'Chercher', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500), + ), + ), + ), + + const SizedBox(height: 8), + + // Container avec la carte + Expanded( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.0), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.1), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(16.0), + child: GoogleMap( + mapType: MapType.normal, + initialCameraPosition: CameraPosition( + target: _initialPosition, + zoom: 12, + ), + onMapCreated: (GoogleMapController controller) {}, + myLocationEnabled: true, + myLocationButtonEnabled: true, + zoomControlsEnabled: true, + compassEnabled: true, + ), + ), + ), + ), + ], + ), + ), + ), + ); } -} \ No newline at end of file +}