This commit is contained in:
2024-11-17 16:02:18 +08:00
commit aa6bca76b3
15 changed files with 1428 additions and 0 deletions

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

3
CHANGELOG.md Normal file
View File

@ -0,0 +1,3 @@
## [0.0.1] - TODO: Add release date.
* TODO: Describe initial release.

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright 2020 yohom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# uni_map_platform_interface
Uni Map Platform Interface.
## Getting Started
This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

8
analysis_options.yaml Normal file
View File

@ -0,0 +1,8 @@
include: package:pedantic/analysis_options.yaml
linter:
rules:
camel_case_types: false
camel_case_extensions: false
omit_local_variable_types: false
prefer_single_quotes: false

104
lib/src/enums.dart Normal file
View File

@ -0,0 +1,104 @@
/// 地图类型
enum MapType {
/// 标准视图
Standard,
/// 卫星视图
Satellite,
/// 黑夜视图
Night,
/// 导航视图
Navi,
/// 公交视图
Bus,
}
/// 地图语言
enum Language {
/// 中文
Chinese,
/// 英文
English,
}
/// 坐标类型
enum CoordType {
GPS,
Google,
MapBar,
Baidu,
MapABC,
SosoMap,
Aliyun,
}
/// 线段末端处样式
enum LineCapType {
/// 普通头
Butt,
/// 扩展头
Square,
/// 箭头
Arrow,
/// 圆形头
Round,
}
/// 线段连接处样式
enum LineJoinType {
/// 斜面连接点
Bevel,
/// 斜接连接点
Miter,
/// 圆角连接点
Round,
}
/// 虚线样式
enum DashType {
/// 方块样式
Square,
/// 圆点样式
Circle,
}
enum MyLocationType {
/// 只定位
Show,
/// 定位一次, 并移动到中心
Locate,
/// 跟随
Follow,
/// 跟随, 但不移动到地图中心
FollowNoCenter,
/// 方向跟随
Rotate,
}
/// 动画重复方式
enum RepeatMode {
Restart,
Reverse,
}
enum RideType {
/// 电动车
elebike,
/// 自行车
bike,
}

1
lib/src/functions.dart Normal file
View File

@ -0,0 +1 @@

301
lib/src/map_controller.dart Normal file
View File

@ -0,0 +1,301 @@
import 'dart:async';
import 'dart:math';
import 'dart:typed_data';
import 'package:core_location_fluttify/core_location_fluttify.dart';
import 'package:flutter/material.dart';
import 'enums.dart';
import 'models.dart';
import 'options.dart';
/// marker点击事件回调签名 输入[Marker]对象
typedef OnMarkerClicked = FutureOr<void> Function(IMarker marker);
/// 地图点击事件回调签名
typedef OnMapClicked = FutureOr<void> Function(LatLng latLng);
/// 地图移动事件回调签名
typedef OnMapMove = FutureOr<void> Function(MapMove move);
/// Marker拖动回调签名
typedef OnMarkerDrag = FutureOr<void> Function(IMarker marker);
/// 地图控制类
abstract class IMapController {
/// Dispose map controller.
Future<void> dispose();
/// Add tile overlay.
Future<IUrlTileOverlay> addUrlTileOverlay(UrlTileOption option);
/// Get current location.
Future<LatLng?> getLocation();
/// Show my location with [option].
Future<void> showMyLocation(MyLocationOption option);
/// 设置我的位置图标旋转角度
Future<void> setMyLocationRotateAngle(double angle);
/// 是否显示室内地图
Future<void> showIndoorMap(bool show);
/// 选择显示图层
Future<void> setMapType(MapType mapType);
/// 显示路况信息
Future<void> showTraffic(bool enable);
/// 显示缩放控件
Future<void> showZoomControl(bool enable);
/// 显示指南针
Future<void> showCompass(bool enable);
/// 显示定位按钮
Future<void> showLocateControl(bool enable);
/// 显示比例尺控件
Future<void> showScaleControl(bool enable);
/// 缩放手势使能
Future<void> setZoomGesturesEnabled(bool enable);
/// 滑动手势使能
Future<void> setScrollGesturesEnabled(bool enable);
/// 旋转手势使能
Future<void> setRotateGesturesEnabled(bool enable);
/// 旋转手势使能
Future<void> setTiltGesturesEnabled(bool enable);
/// 所有手势使能
Future<void> setAllGesturesEnabled(bool enable);
/// 设置缩放大小
///
/// 地图的缩放级别一共分为 17 级,从 3 到 19. 数字越大,展示的图面信息越精细
Future<void> setZoomLevel(double level, {bool animated = true});
/// 获取当前缩放大小
Future<double?> getZoomLevel();
/// 设置缩放是否以中心点为锚点
Future<void> setZoomByCenter(bool byCenter);
/// 放大一个等级
Future<void> zoomIn({bool animated = true});
/// 放大一个等级
Future<void> zoomOut({bool animated = true});
/// 设置地图中心点
///
/// [lat]纬度, [lng]经度, [zoomLevel]缩放等级, [bearing]地图选择角度, [tilt]倾斜角
Future<void> setCenterCoordinate(
LatLng coordinate, {
double? zoomLevel,
double? bearing,
double? tilt,
bool animated = true,
});
/// 获取地图中心点
Future<LatLng?> getCenterCoordinate();
/// 添加marker
///
/// 在纬度[lat], 经度[lng]的位置添加marker, 并设置标题[title]和副标题[snippet], [iconUri]
/// 可以是图片url, asset路径或者文件路径.
/// 其中图片参数[imageConfig]如果不知道怎么创建, 那么就直接调用flutter sdk内提供的[createLocalImageConfiguration]方法创建
Future<IMarker> addMarker(MarkerOption option);
/// 批量添加marker
///
/// 根据[options]批量创建Marker
Future<List<IMarker>> addMarkers(List<MarkerOption> options);
/// 把marker列表从地图上移除
Future<void> clearMarkers(List<IMarker> markers);
/// 清除地图上所有覆盖物
///
/// 根据[keepMyLocation]区分是否保留我的位置的marker
Future<void> clear({bool keepMyLocation = true});
/// 屏幕坐标转经纬度坐标
Future<LatLng?> fromScreenLocation(Point point);
/// 经纬度坐标转屏幕坐标
Future<Point?> toScreenLocation(LatLng coordinate);
/// 添加折线
///
/// 可配置参数详见[PolylineOption]
Future<IPolyline> addPolyline(PolylineOption option);
/// 添加多边形
///
/// 在点[points]的位置添加线, 可以设置宽度[width]和颜色[strokeColor]
Future<IPolygon> addPolygon(PolygonOption option);
/// 添加圆
///
/// 在点[points]的位置添加线, 可以设置宽度[width]和颜色[strokeColor]
Future<ICircle> addCircle(CircleOption option);
/// 设置marker点击监听事件
Future<void> setMarkerClickedListener(OnMarkerClicked onMarkerClicked);
/// 设置marker拖动监听事件
Future<void> setMarkerDragListener({
OnMarkerDrag? onMarkerDragStart,
OnMarkerDrag? onMarkerDragging,
OnMarkerDrag? onMarkerDragEnd,
});
/// 设置地图点击监听事件
Future<void> setMapClickedListener(OnMapClicked onMapClick);
/// 设置地图长按监听事件
Future<void> setMapLongPressedListener(OnMapClicked onMapLongPress);
/// 设置地图移动监听事件
Future<void> setMapMoveListener({
OnMapMove? onMapMoveStart,
OnMapMove? onMapMoving,
OnMapMove? onMapMoveEnd,
});
/// 截图
Future<Uint8List?> screenShot();
/// 限制地图的显示范围
///
/// [southWest]西南角, [northEast]东北角
Future<void> setMapRegionLimits(LatLng southWest, LatLng northEast);
/// Marker弹窗点击事件监听
Future<void> setInfoWindowClickListener(OnMarkerClicked onInfoWindowClicked);
/// 添加图片覆盖物
Future<IGroundOverlay> addGroundOverlay(GroundOverlayOption option);
/// 添加热力图
Future<IHeatmapOverlay> addHeatmapTileOverlay(HeatmapTileOption option);
/// 将指定的经纬度列表(包括但不限于marker, polyline, polygon等)调整至同一屏幕中显示
///
/// [bounds]边界点形成的边界, [padding]地图内边距
Future<void> zoomToSpan(
List<LatLng> bounds, {
EdgeInsets padding = const EdgeInsets.all(50),
bool animated = true,
});
/// 自定义地图
///
/// 三个参数对应自定义地图压缩包内的三个文件
Future<void> setCustomMapStyle({
String styleDataPath,
String styleExtraPath,
String texturePath,
});
/// 添加平滑移动marker
///
/// 根据[options]批量创建Marker
Future<ISmoothMoveMarker> addSmoothMoveMarker(SmoothMoveMarkerOption option);
/// 添加海量点
Future<IMultiPointOverlay> addMultiPointOverlay(MultiPointOption option);
/// 设置地图朝向
///
/// [bearing] 朝向角度, 单位为度(°), 范围为[0°,360°]
Future<void> setBearing(double bearing, {bool animated = true});
/// 设置地图倾斜度
Future<void> setTilt(double tilt, {bool animated = true});
/// 显示/隐藏3D楼块效果
Future<void> showBuildings(bool show);
/// 显示/隐藏地图上的文字标注
Future<void> showMapText(bool show);
/// 一次性设置地图视角
Future<void> setCameraPosition({
required LatLng coordinate,
double? zoom,
double? tilt,
double? bearing,
bool animated = true,
Duration duration = const Duration(milliseconds: 500),
});
/// 设置最大缩放等级
Future<void> setMaxZoomLevel(double zoomLevel);
/// 设置最小缩放等级
Future<void> setMinZoomLevel(double zoomLevel);
/// 设置地图锚点
Future<void> setMapAnchor(double anchorU, double anchorV);
/// 根据起点[from]和终点[to]坐标, 搜索出路径并将驾车路线规划结果[driveRouteResult]添加到地图上, 可以配置交通拥堵情况[trafficOption],
/// 路线的宽度[lineWidth], 自定纹理[customTexture].
Future<void> addDriveRoute({
required LatLng from,
required LatLng to,
List<LatLng>? passbyPointList,
TrafficOption? trafficOption,
double lineWidth = 10,
ImageProvider? customTexture,
});
/// 添加地区轮廓
///
/// 地区名称[districtName], 轮廓宽度[width], 轮廓颜色[strokeColor], 填充颜色[fillColor]
///
/// 由于一个省份可能包含多个区域, 比如浙江包含很多岛屿, 如果把岛屿也画进去, 那么会非常消耗性能.
/// 业务上而言, 我认为这些岛屿是否画进去基本上不影响使用, 所以增加了[onlyMainDistrict]参数
/// 来控制是否只显示主要部分的边界, 如果你对地区完整度的需求非常高, 那么就把[onlyMainDistrict]
/// 设置为false, 随之而来像浙江这种地区的边界绘制起来就会非常慢.
/// 我的测试结果是MIX 3, release模式下需要5-6秒才能绘制完成.
///
/// 采样率[sampleRate]可以控制经纬度列表的密度, 如果地区边界的经纬度列表长度非常长, 造成了卡顿,
/// 那么可以把采样率调低一点, 这样画出来的区域可能没有采样率为1时那么精确, 但是减小了经纬度列表长度,
/// 可以提升绘制速度.
Future<List<IPolygon>> addDistrictOutline(
String districtName, {
double width = 5,
Color strokeColor = Colors.green,
Color fillColor = Colors.transparent,
bool onlyMainDistrict = true,
double sampleRate = 1.0,
});
/// 添加回放轨迹
///
/// [coordinateList] 路径经纬度列表
/// [width] 路径宽度
/// [strokeColor] 路径颜色
/// [iconProvider] 移动marker的图标
/// [duration] 移动时长
Future<IPlaybackTrace> addPlaybackTrace(
List<LatLng> coordinateList, {
double width = 5,
Color strokeColor = Colors.green,
required ImageProvider iconProvider,
required Duration duration,
});
/// 给地图添加padding
Future<void> setPadding(EdgeInsets padding);
/// 设置的地图刷新帧率
Future<void> setFps(int fps);
}

9
lib/src/map_service.dart Normal file
View File

@ -0,0 +1,9 @@
/// 除了地图以外的功能放在这里, 比如说sdk初始化
abstract class IMapService {
/// 设置ios和android的app key
Future<void> init({
String? iosKey,
String? androidKey,
String? webKey,
});
}

100
lib/src/models.dart Normal file
View File

@ -0,0 +1,100 @@
import 'package:core_location_fluttify/core_location_fluttify.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'options.dart';
abstract class IOverlay {
Future<void> remove();
}
/// 地图标记
abstract class IMarker extends IOverlay {
/// 获取标题
Future<String> get title;
/// 获取副标题
Future<String> get snippet;
/// 获取定位信息
Future<LatLng> get coordinate;
/// 获取自定义信息
Future<String> get object;
/// 设置坐标
Future<void> setCoordinate(LatLng coordinate);
/// 设置可见性
Future<void> setVisible(bool visible);
/// 显示弹窗
Future<void> showInfoWindow();
/// 关闭弹窗
Future<void> hideInfoWindow();
/// 设置图标
Future<void> setIcon(
ImageProvider iconProvider,
ImageConfiguration configuration,
);
/// 设置动画
Future<void> startAnimation(MarkerAnimation animation);
/// 设置角度
///
/// 单位度(°)
Future<void> setAngle(double angle);
/// 设置标题
Future<void> setTitle(String title);
/// 设置副标题
Future<void> setSnippet(String snippet);
}
/// 平滑移动点
abstract class ISmoothMoveMarker extends IOverlay {
Future<void> stop();
}
/// 折线
abstract class IPolyline extends IOverlay {
/// 重新设置折线点列表
///
/// 可用于轨迹记录
Future<void> setCoordinateList(List<LatLng> coordinateList);
}
/// 多边形
abstract class IPolygon extends IOverlay {
Future<bool> contains(LatLng target);
}
/// 圆形
abstract class ICircle extends IOverlay {
/// 设置坐标
Future<void> setCoordinate(LatLng coordinate);
/// 设置半径
Future<void> setRadius(double radius);
}
/// 热力图
abstract class IHeatmapOverlay extends IOverlay {}
/// 瓦片图
abstract class IUrlTileOverlay extends IOverlay {}
/// 图片覆盖物
abstract class IGroundOverlay extends IOverlay {}
/// 海量点
abstract class IMultiPointOverlay extends IOverlay {}
/// 回放轨迹
abstract class IPlaybackTrace extends IOverlay {
Future<void> stop();
}

580
lib/src/options.dart Normal file
View File

@ -0,0 +1,580 @@
import 'package:core_location_fluttify/core_location_fluttify.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'enums.dart';
/// 我的位置选项
@immutable
class MyLocationOption {
MyLocationOption({
this.show = true,
this.myLocationType = MyLocationType.Locate,
this.interval = Duration.zero,
this.strokeColor = Colors.transparent,
this.strokeWidth = 0,
this.fillColor = Colors.transparent,
this.iconProvider,
this.anchorU,
this.anchorV,
});
/// 是否显示
final bool show;
/// 定位类型
final MyLocationType myLocationType;
/// 定位间隔
final Duration interval;
/// 边框颜色
final Color strokeColor;
/// 边框宽度
final double strokeWidth;
/// 填充颜色
final Color fillColor;
/// 图标
///
/// 资源图片则使用[AssetImage], 网络图片则使用[NetworkImage], 文件图片则使用[FileImage]
final ImageProvider? iconProvider;
/// 锚点
final double? anchorU, anchorV;
@override
String toString() {
return 'MyLocationOption{show: $show, myLocationType: $myLocationType, interval: $interval, strokeColor: $strokeColor, strokeWidth: $strokeWidth, fillColor: $fillColor, iconProvider: $iconProvider, anchorU: $anchorU, anchorV: $anchorV}';
}
}
/// Marker创建参数
@immutable
class MarkerOption {
MarkerOption({
required this.coordinate,
this.title = '',
this.snippet = '',
this.widget,
this.draggable = false,
this.infoWindowEnabled = true,
this.visible = true,
this.rotateAngle = 0,
this.anchorU = 0.5,
this.anchorV = 0,
this.object,
this.opacity,
this.iconProvider,
this.iconsProvider,
this.animationFps,
this.infoWindow,
}) : assert(!(widget != null && iconProvider != null),
'widget和iconProvider不能同时设置! ');
/// 经纬度
final LatLng coordinate;
/// 标题
final String title;
/// 副标题
final String snippet;
/// Widget形式的Marker
///
/// 不能和[iconProvider]一起用.
/// 注意控制Widget的大小, 比如Column默认是max, 会使用地图的高度, 那么此时需要设置成min.
final Widget? widget;
/// 是否可拖动
final bool draggable;
/// 是否允许弹窗
final bool infoWindowEnabled;
/// 是否可见
final bool visible;
/// 旋转角度 单位为度(°)
final double rotateAngle;
/// 横轴锚点
final double anchorU;
/// 纵轴锚点
final double anchorV;
/// 自定义数据 理论上可以使用任何类型的数据, 但是为了减少意外情况, 这里一律转换成String来保存
final String? object;
/// 透明度
final double? opacity;
/// 图标
final ImageProvider? iconProvider;
/// 帧动画图标
final List<ImageProvider>? iconsProvider;
/// 帧动画帧率
///
/// 最大60, 最小3
final int? animationFps;
final Widget? infoWindow;
@override
String toString() {
return 'MarkerOption{coordinate: $coordinate, title: $title, snippet: $snippet, widget: $widget, draggable: $draggable, infoWindowEnabled: $infoWindowEnabled, visible: $visible, rotateAngle: $rotateAngle, anchorU: $anchorU, anchorV: $anchorV, object: $object, iconProvider: $iconProvider}';
}
}
/// 平滑移动Marker创建参数
@immutable
class SmoothMoveMarkerOption {
SmoothMoveMarkerOption({
required this.path,
required this.duration,
required this.iconProvider,
});
/// 轨迹经纬度列表
final List<LatLng> path;
/// 图标
final ImageProvider iconProvider;
/// 动画时长
final Duration duration;
@override
String toString() {
return 'SmoothMoveMarkerOption{path: $path, iconProvider: $iconProvider, duration: $duration}';
}
}
/// Polyline创建参数
@immutable
class PolylineOption {
PolylineOption({
required this.coordinateList,
this.width = 5,
this.strokeColor = Colors.green,
this.textureProvider,
this.lineCapType,
this.lineJoinType,
this.dashType,
});
/// 经纬度列表
final List<LatLng> coordinateList;
/// 宽度
final double width;
/// 颜色
final Color strokeColor;
/// 自定义纹理
final ImageProvider? textureProvider;
/// 线段末端样式
final LineCapType? lineCapType;
/// 线段连接处样式
final LineJoinType? lineJoinType;
/// 是否虚线
final DashType? dashType;
@override
String toString() {
return 'PolylineOption{latLngList: $coordinateList, width: $width, strokeColor: $strokeColor, textureProvider: $textureProvider, lineCapType: $lineCapType, lineJoinType: $lineJoinType, dashType: $dashType}';
}
}
/// Polygon创建参数
@immutable
class PolygonOption {
PolygonOption({
required this.coordinateList,
this.width = 5,
this.strokeColor = Colors.green,
this.fillColor = Colors.transparent,
this.zIndex,
});
/// 经纬度列表
final List<LatLng> coordinateList;
/// 宽度
final double width;
/// 边框颜色
final Color strokeColor;
/// 填充颜色
final Color fillColor;
/// z index
final double? zIndex;
@override
String toString() {
return 'PolygonOption{latLngList: $coordinateList, width: $width, strokeColor: $strokeColor, fillColor: $fillColor}';
}
}
/// Circle创建参数
@immutable
class CircleOption {
/// 中心点经纬度
final LatLng center;
/// 宽度
final double radius;
/// 宽度
final double width;
/// 边框颜色
final Color strokeColor;
/// 填充颜色
final Color fillColor;
CircleOption({
required this.center,
required this.radius,
this.width = 5,
this.strokeColor = Colors.green,
this.fillColor = Colors.transparent,
});
@override
String toString() {
return 'CircleOption{center: $center, radius: $radius, width: $width, strokeColor: $strokeColor, fillColor: $fillColor}';
}
}
/// TileOverlay创建参数
@immutable
class HeatmapTileOption {
HeatmapTileOption({
required this.coordinateList,
this.gradient,
});
/// 中心点经纬度
final List<LatLng> coordinateList;
/// 热力图渐变色配置
///
/// [RadialGradient.stops]的值范围为(0,1), 默认值为[0.2,0.5,0.9]
/// [RadialGradient.stops]和[RadialGradient.colors]列表的长度必须一致
final RadialGradient? gradient;
@override
String toString() {
return 'HeatmapTileOption{latLngList: $coordinateList}';
}
}
/// 图片覆盖物创建参数
@immutable
class GroundOverlayOption {
GroundOverlayOption({
required this.southWest,
required this.northEast,
required this.imageProvider,
});
final LatLng southWest;
final LatLng northEast;
final ImageProvider imageProvider;
@override
String toString() {
return 'GroundOverlayOption{southWest: $southWest, northEast: $northEast, imageProvider: $imageProvider}';
}
}
/// 瓦片图创建参数
@immutable
class UrlTileOption {
UrlTileOption({
required this.width,
required this.height,
required this.urlTemplate,
});
/// 单位瓦片图宽度
final int width;
/// 单位瓦片图高度
final int height;
/// 瓦片图地址模板
///
/// 瓦片图地址模板是一个包含"{x}","{y}","{z}","{scale}"的字符串,"{x}","{y}","{z}","{scale}"会被tile path的值所替换
/// 并生成用来加载tile图片数据的URL 。例如 http://server/path?x={x}&y={y}&z={z}&scale={scale}
final String urlTemplate;
@override
String toString() {
return 'UrlTileOption{width: $width, height: $height, urlTemplate: $urlTemplate}';
}
}
/// 海量点创建参数
@immutable
class MultiPointOption {
MultiPointOption({
required this.pointList,
this.iconProvider,
});
/// 点列表
final List<PointOption> pointList;
/// 图标
final ImageProvider? iconProvider;
@override
String toString() {
return 'MultiPointOption{pointList: $pointList, iconProvider: $iconProvider}';
}
}
/// 海量点中单个点的创建参数
@immutable
class PointOption {
PointOption({
required this.coordinate,
this.id,
this.title,
this.snippet,
this.object,
});
/// 经纬度
final LatLng coordinate;
/// 点的id列表, 用来区分点
final String? id;
/// 标题列表
final String? title;
/// 副标题列表
final String? snippet;
/// 自定义数据
final String? object;
@override
String toString() {
return 'PointOption{coordinate: $coordinate, id: $id, title: $title, snippet: $snippet, object: $object}';
}
}
/// 地图移动
@immutable
class MapMove {
MapMove({
this.coordinate,
this.zoom,
this.tilt,
this.bearing,
this.isAbroad,
});
/// 经纬度
final LatLng? coordinate;
/// 缩放等级
final double? zoom;
/// 倾斜度
final double? tilt;
/// 朝向
final double? bearing;
/// 是否是国外
final bool? isAbroad;
@override
String toString() {
return 'MapMove{latLng: $coordinate, zoom: $zoom, tilt: $tilt, bearing: $bearing, isAbroad: $isAbroad}';
}
}
/// 屏幕坐标
@immutable
class TraceLocation {
TraceLocation({
required this.latitude,
required this.longitude,
required this.speed,
required this.bearing,
required this.time,
});
final double latitude;
final double longitude;
final double speed;
final double bearing;
final int time;
@override
String toString() {
return 'TraceLocation{latitude: $latitude, longitude: $longitude, speed: $speed, bearing: $bearing, time: $time}';
}
}
/// 交通配置
@immutable
class TrafficOption {
TrafficOption({
required this.show,
this.goodColor = Colors.green,
this.badColor = Colors.yellow,
this.terribleColor = Colors.red,
this.unknownColor = Colors.blue,
});
/// 是否显示
final bool show;
/// 通畅路段颜色
final Color goodColor;
/// 缓行路段颜色
final Color badColor;
/// 拥堵路段颜色
final Color terribleColor;
/// 未知路段颜色
final Color unknownColor;
@override
String toString() {
return 'TrafficOption{show: $show, goodColor: $goodColor, badColor: $badColor, terribleColor: $terribleColor, unknownColor: $unknownColor}';
}
}
/// marker动画基类
@immutable
class MarkerAnimation {
MarkerAnimation(
this.duration,
this.repeatCount,
this.repeatMode,
this.fromValue,
this.toValue,
);
final Duration duration;
final int repeatCount;
final RepeatMode repeatMode;
final double? fromValue;
final double? toValue;
@override
String toString() {
return 'MarkerAnimation{duration: $duration, repeatCount: $repeatCount, repeatMode: $repeatMode, fromValue: $fromValue, toValue: $toValue}';
}
}
/// marker缩放动画
@immutable
class ScaleMarkerAnimation extends MarkerAnimation {
ScaleMarkerAnimation({
Duration duration = const Duration(seconds: 1),
int repeatCount = 1,
RepeatMode repeatMode = RepeatMode.Reverse,
double? fromValue,
double? toValue,
}) : super(duration, repeatCount, repeatMode, fromValue, toValue);
@override
String toString() {
return 'ScaleMarkerAnimation{fromValue: $fromValue, toValue: $toValue}';
}
}
/// marker透明度动画
@immutable
class AlphaMarkerAnimation extends MarkerAnimation {
AlphaMarkerAnimation({
Duration duration = const Duration(seconds: 1),
int repeatCount = 1,
RepeatMode repeatMode = RepeatMode.Reverse,
double? fromValue,
double? toValue,
}) : super(duration, repeatCount, repeatMode, fromValue, toValue);
@override
String toString() {
return 'AlphaMarkerAnimation{fromValue: $fromValue, toValue: $toValue}';
}
}
/// marker旋转动画
@immutable
class RotateMarkerAnimation extends MarkerAnimation {
RotateMarkerAnimation({
Duration duration = const Duration(seconds: 1),
int repeatCount = 1,
RepeatMode repeatMode = RepeatMode.Reverse,
double? fromValue,
double? toValue,
}) : super(duration, repeatCount, repeatMode, fromValue, toValue);
@override
String toString() {
return 'RotateMarkerAnimation{fromValue: $fromValue, toValue: $toValue}';
}
}
/// marker移动动画
@immutable
class TranslateMarkerAnimation extends MarkerAnimation {
TranslateMarkerAnimation({
Duration duration = const Duration(seconds: 1),
int repeatCount = 1,
RepeatMode repeatMode = RepeatMode.Reverse,
required this.coordinate,
}) : super(duration, repeatCount, repeatMode, null, null);
final LatLng coordinate;
@override
String toString() {
return 'TranslateMarkerAnimation{toValue: $coordinate}';
}
}
/// marker动画集合
@immutable
class MarkerAnimationSet extends MarkerAnimation {
MarkerAnimationSet({
this.animationSet,
required Duration duration,
int repeatCount = 1,
RepeatMode repeatMode = RepeatMode.Reverse,
}) : super(duration, repeatCount, repeatMode, null, null);
final List<MarkerAnimation>? animationSet;
@override
String toString() {
return 'MarkerAnimationSet{animationSet: $animationSet}';
}
}

View File

@ -0,0 +1,11 @@
library uni_map_platform_interface;
export 'package:core_location_fluttify/core_location_fluttify.dart';
export 'package:foundation_fluttify/foundation_fluttify.dart';
export 'src/enums.dart';
export 'src/functions.dart';
export 'src/map_controller.dart';
export 'src/map_service.dart';
export 'src/models.dart';
export 'src/options.dart';

220
pubspec.lock Normal file
View File

@ -0,0 +1,220 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
core_location_fluttify:
dependency: "direct main"
description:
path: "D:\\FlutterProjects\\core_location_fluttify"
relative: false
source: path
version: "0.7.1"
fake_async:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
url: "https://pub.dev"
source: hosted
version: "1.0.4"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
foundation_fluttify:
dependency: "direct main"
description:
name: foundation_fluttify
sha256: ca669cd6090a8de44a099e418523badf34ef14f03703a544431f2dd95411062e
url: "https://pub.dev"
source: hosted
version: "0.13.0+1"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
url: "https://pub.dev"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.15.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.5"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"

20
pubspec.yaml Normal file
View File

@ -0,0 +1,20 @@
name: uni_map_platform_interface
description: Uni Map Platform Interface.
version: 0.7.0-rc.0
environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
foundation_fluttify:
path: ..\foundation_fluttify
core_location_fluttify:
path: ..\core_location_fluttify
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.4

View File

@ -0,0 +1 @@
void main() {}