Camera padding for FollowPuckViewportState?
is there a way to add a camera padding for FollowPuckViewportState?
i have this code which zooms on the user location in my map, what i want is to make it so that we show the user location at the bottom portion of the screen, is there a possible way for that?
` import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart' as mapbox; import 'package:cee/domain/services/location_service.dart';
part 'map_viewport_provider.g.dart';
@riverpod class MapViewportState extends _$MapViewportState { final _locationService = LocationServiceImpl();
@override FutureOr<mapbox.ViewportState> build() async { final position = await _locationService.getCurrentLocation();
if (position == null) {
throw Exception('Could not get current location');
}
// Start with FollowPuckViewportState by default
return mapbox.FollowPuckViewportState(
zoom: 15.5,
bearing: mapbox.FollowPuckViewportStateBearingCourse(),
pitch: 45,
);
}
// Called when user interacts with map void setIdleState() { state = const AsyncValue.data(mapbox.IdleViewportState()); }
// Called when location panning button is pressed void enableFollowPuckMode() { state = AsyncValue.data(mapbox.FollowPuckViewportState( zoom: 15.5, bearing: mapbox.FollowPuckViewportStateBearingCourse(), pitch: 45, )); } } `
You can add padding but it does not work from Flutter, see #816