feat: enhance global search and map experience
- Global Activity Search: - Allow searching activities globally (not just in destination). - Add distance warning for activities > 50km away. - Create Trip UI: - Fix destination suggestion list overflow. - Prevent suggestion list from reappearing after selection. - Map: - Add generic text search support (e.g., "Restaurants") on 'Enter'. - Display multiple results for generic searches. - Resize markers (User 60.0, Places 50.0). - Standardize place markers to red pin.
This commit is contained in:
@@ -135,7 +135,11 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
}
|
||||
}
|
||||
|
||||
bool _isProgrammaticUpdate = false;
|
||||
|
||||
void _onLocationChanged() {
|
||||
if (_isProgrammaticUpdate) return;
|
||||
|
||||
final query = _locationController.text.trim();
|
||||
|
||||
if (query.length < 2) {
|
||||
@@ -215,15 +219,18 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
|
||||
if (_placeSuggestions.isEmpty) return;
|
||||
|
||||
final overlay = Overlay.of(context);
|
||||
|
||||
// Calculer la largeur correcte en fonction du padding parent (16 margin + 24 padding = 40 de chaque côté)
|
||||
final width = MediaQuery.of(context).size.width - 80;
|
||||
|
||||
_suggestionsOverlay = OverlayEntry(
|
||||
builder: (context) => Positioned(
|
||||
width:
|
||||
MediaQuery.of(context).size.width -
|
||||
32, // Largeur du champ avec padding
|
||||
width: width,
|
||||
child: CompositedTransformFollower(
|
||||
link: _layerLink,
|
||||
showWhenUnlinked: false,
|
||||
offset: const Offset(0, 60), // Position sous le champ
|
||||
targetAnchor: Alignment.bottomLeft,
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -236,6 +243,7 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: _placeSuggestions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final suggestion = _placeSuggestions[index];
|
||||
@@ -256,7 +264,7 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
),
|
||||
);
|
||||
|
||||
Overlay.of(context).insert(_suggestionsOverlay!);
|
||||
overlay.insert(_suggestionsOverlay!);
|
||||
}
|
||||
|
||||
void _hideSuggestions() {
|
||||
@@ -265,7 +273,10 @@ class _CreateTripContentState extends State<CreateTripContent> {
|
||||
}
|
||||
|
||||
void _selectSuggestion(PlaceSuggestion suggestion) {
|
||||
_isProgrammaticUpdate = true;
|
||||
_locationController.text = suggestion.description;
|
||||
_isProgrammaticUpdate = false;
|
||||
|
||||
_hideSuggestions();
|
||||
setState(() {
|
||||
_placeSuggestions = [];
|
||||
|
||||
Reference in New Issue
Block a user