Skip to content

Commit

Permalink
publish: 1.0.0-rc
Browse files Browse the repository at this point in the history
  • Loading branch information
liodali committed Jan 27, 2024
1 parent f5be7ff commit a5b754a
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 103 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### 1.0.0-rc:
* add support draw shapes in iOS side
### 1.0.0-dev.4:
* improve picker_map_controller
* improve picker dialog and widget
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

# flutter_osm_plugin
![pub](https://img.shields.io/badge/pub-v1.0.0--dev.4-yellow)
![pub](https://img.shields.io/badge/pub-v1.0.0--rc-yellow)


## Platform Support
Expand Down Expand Up @@ -31,7 +31,7 @@
* ClickListener on Map (Android/iOS/web)
* calculate distance between 2 points
* address suggestion
* draw shapes (Android/web)
* draw shapes (Android/iOS/web)
* simple dialog location picker (Android/iOS)
* listen to region change (Android/iOS/Web)
* set custom tiles (Android/iOS/Web)
Expand All @@ -49,7 +49,7 @@
Add the following to your `pubspec.yaml` file:

dependencies:
flutter_osm_plugin: ^1.0.0-dev.4
flutter_osm_plugin: ^1.0.0-rc



Expand Down Expand Up @@ -584,8 +584,10 @@ final configs = [
centerPoint: GeoPoint(latitude: 47.4333594, longitude: 8.4680184),
radius: 1200.0,
color: Colors.red,
borderColor:Colors.green,
strokeWidth: 0.3,
));
)
);
/// to remove Circle using Key
await controller.removeCircle("circle0");
Expand All @@ -600,7 +602,8 @@ final configs = [
key: "rect",
centerPoint: GeoPoint(latitude: 47.4333594, longitude: 8.4680184),
distance: 1200.0,
color: Colors.red,
color: Colors.red.withOpacity(0.4),
borderColor:Colors.green,
strokeWidth: 0.3,
));
/// to remove Rect using Key
Expand Down
13 changes: 12 additions & 1 deletion example/lib/src/home/home_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,18 @@ class _MainExampleState extends State<OldMainExample>
),
),
); */

// controller = MapController.customLayer(
// //initPosition: initPosition,
// initMapWithUserPosition: UserTrackingOption(),
// customTile: CustomTile(
// urlsServers: [
// TileURLs(url: "https://tile.openstreetmap.de/"),
// ],
// tileExtension: ".png",
// sourceName: "osmGermany",
// maxZoomLevel: 20,
// ),
// );
/* controller = MapController.customLayer(
initMapWithUserPosition: false,
initPosition: GeoPoint(
Expand Down
198 changes: 102 additions & 96 deletions example/lib/src/home/main_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,49 +123,66 @@ class _MainState extends State<Main> with OSMMixinObserver {
),
)
],
if (!kIsWeb) ...[
Positioned(
top: (MediaQuery.maybeOf(context)?.viewPadding.top ?? 26) + 48,
right: 15,
child: MapRotation(
controller: controller,
),
)
],
Positioned(
top: kIsWeb
? 26
: MediaQuery.maybeOf(context)?.viewPadding.top ?? 26.0,
left: 12,
child: PointerInterceptor(
child: MainNavigation(),
),
),
Positioned(
bottom: 32,
right: 15,
child: ActivationUserLocation(
controller: controller,
showFab: showFab,
trackingNotifier: trackingNotifier,
userLocationIcon: userLocationIcon,
),
),
Positioned(
bottom: 92,
right: 15,
child: DirectionRouteLocation(
controller: controller,
),
),
Positioned(
top: kIsWeb ? 26 : MediaQuery.maybeOf(context)?.viewPadding.top,
left: 64,
right: 72,
child: SearchInMap(
controller: controller,
Positioned.fill(
child: ValueListenableBuilder(
valueListenable: showFab,
builder: (context, isVisible, child) {
if (!isVisible) {
return SizedBox.shrink();
}
return Stack(
children: [
if (!kIsWeb) ...[
Positioned(
top:
(MediaQuery.maybeOf(context)?.viewPadding.top ?? 26) +
48,
right: 15,
child: MapRotation(
controller: controller,
),
)
],
Positioned(
top: kIsWeb
? 26
: MediaQuery.maybeOf(context)?.viewPadding.top ?? 26.0,
left: 12,
child: PointerInterceptor(
child: MainNavigation(),
),
),
Positioned(
bottom: 32,
right: 15,
child: ActivationUserLocation(
controller: controller,
trackingNotifier: trackingNotifier,
userLocationIcon: userLocationIcon,
),
),
Positioned(
bottom: 92,
right: 15,
child: DirectionRouteLocation(
controller: controller,
),
),
Positioned(
top: kIsWeb
? 26
: MediaQuery.maybeOf(context)?.viewPadding.top,
left: 64,
right: 72,
child: SearchInMap(
controller: controller,
),
),
],
);
},
),
),
)
],
);
}
Expand Down Expand Up @@ -445,76 +462,65 @@ class SearchLocation extends StatelessWidget {
}

class ActivationUserLocation extends StatelessWidget {
final ValueNotifier<bool> showFab;
final ValueNotifier<bool> trackingNotifier;
final MapController controller;
final ValueNotifier<IconData> userLocationIcon;

const ActivationUserLocation({
super.key,
required this.showFab,
required this.trackingNotifier,
required this.controller,
required this.userLocationIcon,
});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<bool>(
valueListenable: showFab,
builder: (ctx, isShow, child) {
if (!isShow) {
return SizedBox.shrink();
}
return child!;
},
child: PointerInterceptor(
child: GestureDetector(
behavior: HitTestBehavior.deferToChild,
onLongPress: () async {
await controller.disabledTracking();
trackingNotifier.value = false;
},
child: FloatingActionButton(
key: UniqueKey(),
onPressed: () async {
if (!trackingNotifier.value) {
await controller.currentLocation();
await controller.enableTracking(
enableStopFollow: true,
disableUserMarkerRotation: true,
anchor: Anchor.left,
);
trackingNotifier.value = true;
return PointerInterceptor(
child: GestureDetector(
behavior: HitTestBehavior.deferToChild,
onLongPress: () async {
await controller.disabledTracking();
trackingNotifier.value = false;
},
child: FloatingActionButton(
key: UniqueKey(),
onPressed: () async {
if (!trackingNotifier.value) {
await controller.currentLocation();
await controller.enableTracking(
enableStopFollow: true,
disableUserMarkerRotation: true,
anchor: Anchor.left,
);
trackingNotifier.value = true;

//await controller.zoom(5.0);
} else {
await controller.enableTracking(
enableStopFollow: false,
disableUserMarkerRotation: true,
anchor: Anchor.left,
//await controller.zoom(5.0);
} else {
await controller.enableTracking(
enableStopFollow: false,
disableUserMarkerRotation: true,
anchor: Anchor.left,
);
// if (userLocationNotifier.value != null) {
// await controller
// .goToLocation(userLocationNotifier.value!);
// }
}
},
mini: true,
heroTag: "UserLocationFab",
child: ValueListenableBuilder<bool>(
valueListenable: trackingNotifier,
builder: (ctx, isTracking, _) {
if (isTracking) {
return ValueListenableBuilder<IconData>(
valueListenable: userLocationIcon,
builder: (context, icon, _) {
return Icon(icon);
},
);
// if (userLocationNotifier.value != null) {
// await controller
// .goToLocation(userLocationNotifier.value!);
// }
}
return Icon(Icons.near_me);
},
mini: true,
heroTag: "UserLocationFab",
child: ValueListenableBuilder<bool>(
valueListenable: trackingNotifier,
builder: (ctx, isTracking, _) {
if (isTracking) {
return ValueListenableBuilder<IconData>(
valueListenable: userLocationIcon,
builder: (context, icon, _) {
return Icon(icon);
},
);
}
return Icon(Icons.near_me);
},
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_osm_plugin
description: OpenStreetMap Plugin Native for flutter apps (Andoird/iOS/web)
version: 1.0.0-dev.4
version: 1.0.0-rc


homepage: https://github.com/liodali/osm_flutter
Expand Down

0 comments on commit a5b754a

Please sign in to comment.