polaris_map_editor

Creator: coderz1093

Last updated:

0 purchases

polaris_map_editor Image
polaris_map_editor Images
Add to Cart

Description:

polaris map editor

Polaris Map Editor #
PolarisMapEditor is a Flutter library for creating map editors with a celestial touch, allowing users to interactively draw areas on the map. The library is inspired by the concept of Polaris, the North Star, providing a reliable point of reference.

Getting started #
Import the library into your Dart code:
import 'package:polaris_map_editor/polaris_map_editor.dart';
copied to clipboard
How to Use #
PolarisMapEditor Widget #
import 'package:polaris_map_editor/polaris_map_editor.dart';

PolarisMapEditor(
mapController: mapController,
options: PolarisOptions.defaultOptions(
color: Colors.deepPurple,
// optional: enable search places
googlePlaceApiKey: Platform.isMacOS || Platform.isIOS
? Config.googlePlaceIosKey
: Config.googlePlaceAndroidKey,
),
onAreaChanged: print,
child: FlutterMap(
mapController: mapController,
options: MapOptions(
interactionOptions: InteractionOptions(
cursorKeyboardRotationOptions:
CursorKeyboardRotationOptions.disabled(), // prevent shortcuts
),
),
children: const [
OpenStreeTileLayer(), // replace with your tile layer
PolarisLayer(), // <===== Polaris widget, includes AreaLayer, LinesLayer and PointsLayer
],
),
)
copied to clipboard
PolarisOptions #
The core widget responsible for customizing the Polaris map editor. Integrates seamlessly with Flutter Map and provides customization options.
factory PolarisOptions.defaultOptions({
Color color = Colors.blue,
String? googlePlaceApiKey,
}) {
return PolarisOptions(
menu: const MenuOptions(
enabled: true,
),
area: AreaOptions(
color: color.withOpacity(0.3),
isFilled: true,
),
line: LineOptions(
color: color,
strokeWidth: 3,
),
draggedLine: LineOptions(
color: color,
strokeWidth: 3,
isDotted: true,
),
point: PointOptions(
icon: Icon(
Icons.circle,
color: color,
size: 14,
),
lastPointIcon: Stack(
fit: StackFit.expand,
children: [
Icon(
Icons.circle,
color: color,
size: 10,
),
Icon(
Icons.circle_outlined,
color: color,
size: 19,
),
],
),
),
place: googlePlaceApiKey != null
? PlaceOptions.googleMapService(apiKey: googlePlaceApiKey)
: null,
mouse: const MouseOptions(),
shortcut: const ShortcutOptions(
undo: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyZ],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.keyZ],
],
redo: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyY],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.keyY],
[
LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.keyZ
],
[
LogicalKeyboardKey.metaLeft,
LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.keyZ
],
],
search: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyF],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.keyF],
],
zoomIn: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.add],
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.equal],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.add],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.equal],
[
LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.add
],
[
LogicalKeyboardKey.metaLeft,
LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.add
],
],
zoomOut: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.minus],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.minus],
],
fitCameraToArea: [
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyH],
[LogicalKeyboardKey.metaLeft, LogicalKeyboardKey.keyH],
],
deletePoint: [
[LogicalKeyboardKey.controlLeft],
],
),
);
}
copied to clipboard
Contributing #
Contributions are welcome! If you encounter any issues or have suggestions, feel free to open an issue or submit a pull request.
License #
This project is licensed under the BSD 3-Clause License.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.