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:
@@ -13,6 +13,7 @@ import '../../blocs/user/user_bloc.dart';
|
||||
import '../../blocs/user/user_state.dart';
|
||||
import '../../services/error_service.dart';
|
||||
import 'activity_detail_dialog.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
|
||||
class ActivitiesPage extends StatefulWidget {
|
||||
final Trip trip;
|
||||
@@ -637,6 +638,23 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
activity.name.toLowerCase().trim(),
|
||||
);
|
||||
|
||||
// Calculer la distance si c'est une suggestion Google et que le voyage a des coordonnées
|
||||
double? distanceInKm;
|
||||
if (isGoogleSuggestion &&
|
||||
widget.trip.hasCoordinates &&
|
||||
activity.latitude != null &&
|
||||
activity.longitude != null) {
|
||||
final distanceInMeters = Geolocator.distanceBetween(
|
||||
widget.trip.latitude!,
|
||||
widget.trip.longitude!,
|
||||
activity.latitude!,
|
||||
activity.longitude!,
|
||||
);
|
||||
distanceInKm = distanceInMeters / 1000;
|
||||
}
|
||||
|
||||
final isFar = distanceInKm != null && distanceInKm > 50;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
@@ -709,6 +727,40 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (isFar)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.errorContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.error.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: theme.colorScheme.error,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Activité éloignée : ${distanceInKm!.toStringAsFixed(0)} km du lieu du voyage',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onErrorContainer,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
// Icône de catégorie
|
||||
|
||||
Reference in New Issue
Block a user