115 lines
3.7 KiB
Dart
115 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
class MapContent extends StatefulWidget {
|
|
const MapContent({super.key});
|
|
|
|
@override
|
|
State<MapContent> createState() => _MapContentState();
|
|
}
|
|
|
|
class _MapContentState extends State<MapContent> {
|
|
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 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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|