Update Gradle configuration to use Java 17 and enhance map UI with search functionality

This commit is contained in:
Dayron
2025-10-06 15:14:35 +02:00
parent 797f77cf69
commit 0b9a140620
2 changed files with 102 additions and 9 deletions

View File

@@ -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 {

View File

@@ -9,13 +9,106 @@ class MapContent extends StatefulWidget {
}
class _MapContentState extends State<MapContent> {
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(
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,
),
),
),
),
],
),
),
),
);
}
}