import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'map_provider_interface.dart'; import 'map_providers.dart'; class UnifiedMapView extends ConsumerWidget { final AppLatLng center; final double zoom; final List markers; final List polylines; final ValueChanged? onPositionChanged; final VoidCallback? onUserInteraction; const UnifiedMapView({ super.key, required this.center, this.zoom = 16.0, this.markers = const [], this.polylines = const [], this.onPositionChanged, this.onUserInteraction, }); @override Widget build(BuildContext context, WidgetRef ref) { final provider = ref.watch(activeMapProvider); final config = ref.watch(mapConfigProvider); final isFollowMode = ref.watch(mapFollowStateProvider); return provider.buildMapView( context: context, center: center, zoom: zoom, markers: markers, polylines: polylines, isFollowMode: isFollowMode, config: config, onPositionChanged: onPositionChanged, onUserInteraction: () { ref.read(mapFollowStateProvider.notifier).userInteracted(); onUserInteraction?.call(); }, ); } }