You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
));
}
}
`
The text was updated successfully, but these errors were encountered:
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();
}
// 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,
));
}
}
`
The text was updated successfully, but these errors were encountered: