Skip to content

Commit

Permalink
feat(map-view): add compass
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-the-shark committed Sep 20, 2024
1 parent f49b358 commit eb11c8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/features/map_view/widgets/map_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "dart:io";
import "package:flutter/material.dart";
import "package:flutter_map/flutter_map.dart";
import "package:flutter_map_cancellable_tile_provider/flutter_map_cancellable_tile_provider.dart";
import "package:flutter_map_compass/flutter_map_compass.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";

import "../../../config/map_view_config.dart";
Expand Down Expand Up @@ -45,10 +46,20 @@ class MapWidget<T extends GoogleNavigable> extends ConsumerWidget {
),
MarkersConsumerLayer<T>(),
const MyLocationLayer(),
Positioned(
right: 0,
top: MediaQuery.paddingOf(context).top,
child: const MyLocationButton(),
const Positioned(
top: 4,
right: 4,
child: SafeArea(
child: Column(
children: [
MyLocationButton(),
MapCompass.cupertino(
hideIfRotatedNorth: true,
padding: EdgeInsets.zero,
),
],
),
),
),
const OpenMapAtrribution(),
],
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ dependencies:
latlong2: ^0.9.1
flutter_map_cancellable_tile_provider: ^3.0.2
flutter_map_location_marker: ^9.1.1
flutter_map_compass: ^1.0.3

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit eb11c8a

Please sign in to comment.