提交 f0784f7f authored 作者: shixiaochen's avatar shixiaochen

1、Android-设置已中心点地图缩放;

上级 06e01335
......@@ -39,6 +39,8 @@ class AMapOptionsBuilder implements AMapOptionsSink {
private float anchorX = 2.0F;
private float anchorY = 2.0F;
private boolean center = true;
private Object initialMarkers;
private Object initialPolylines;
......@@ -69,7 +71,8 @@ class AMapOptionsBuilder implements AMapOptionsSink {
aMapPlatformView.getMapController().setScreenAnchor( anchorX, anchorY);
}
// 设置以中心点缩放
aMapPlatformView.getMapController().setGestureScaleByMapCenter(true);
aMapPlatformView.getMapController().setMinZoomLevel(minZoomLevel);
aMapPlatformView.getMapController().setMaxZoomLevel(maxZoomLevel);
......@@ -130,6 +133,11 @@ class AMapOptionsBuilder implements AMapOptionsSink {
anchorY = y;
}
@Override
public void setGestureScaleByMapCenter(boolean center) {
this.center = center;
}
@Override
public void setMinZoomLevel(float minZoomLevel) {
this.minZoomLevel = minZoomLevel;
......
......@@ -24,6 +24,8 @@ public interface AMapOptionsSink {
public void setScreenAnchor(float x, float y);
public void setGestureScaleByMapCenter(boolean center);
public void setMinZoomLevel(float minZoomLevel);
public void setMaxZoomLevel(float maxZoomLevel);
......
......@@ -285,6 +285,11 @@ public class MapController
amap.setPointToCenter(Float.valueOf(mapView.getWidth() * x).intValue(), Float.valueOf(mapView.getHeight() * y).intValue());
}
@Override
public void setGestureScaleByMapCenter(boolean center) {
amap.getUiSettings().setGestureScaleByMapCenter(center);
}
@Override
public void setMinZoomLevel(float minZoomLevel) {
amap.setMinZoomLevel(minZoomLevel);
......
......@@ -24,12 +24,12 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("app/key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
//def keystorePropertiesFile = rootProject.file("app/key.properties")
//def keystoreProperties = new Properties()
//keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 31
compileSdkVersion 33
lintOptions {
disable 'InvalidPackage'
......@@ -44,24 +44,24 @@ android {
versionName flutterVersionName
}
signingConfigs {
release {
//keystore中key的别名
keyAlias keystoreProperties['keyAlias']
//keystore中key的密码
keyPassword keystoreProperties['keyPassword']
//keystore的文件路径,可以是绝对路径也可以是相对路径
storeFile file(keystoreProperties['storeFile'])
//keystore的密码l
storePassword keystoreProperties['storePassword']
}
// release {
// //keystore中key的别名
// keyAlias keystoreProperties['keyAlias']
// //keystore中key的密码
// keyPassword keystoreProperties['keyPassword']
// //keystore的文件路径,可以是绝对路径也可以是相对路径
// storeFile file(keystoreProperties['storeFile'])
// //keystore的密码l
// storePassword keystoreProperties['storePassword']
// }
}
buildTypes {
debug {
signingConfig signingConfigs.release
// signingConfig signingConfigs.release
}
release {
// flutter build apk
signingConfig signingConfigs.release
// signingConfig signingConfigs.release
}
}
sourceSets {
......
......@@ -22,6 +22,7 @@
android:value="6a158bd9bdede0d4276a7ab4fc45ca1b" />
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
......
......@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.3.0'
}
}
......@@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
......@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
import 'dart:typed_data';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:amap_flutter_map_example/base_page.dart';
import 'package:amap_flutter_map_example/const_config.dart';
import 'package:amap_flutter_map_example/widgets/amap_switch_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
class AllMapConfigDemoPage extends BasePage {
AllMapConfigDemoPage(String title, String subTitle) : super(title, subTitle);
......@@ -342,10 +338,21 @@ class _MapUiBodyState extends State<_MapUiBody> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.6,
width: MediaQuery.of(context).size.width,
child: map,
Stack(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.6,
width: MediaQuery.of(context).size.width,
child: map,
),
Positioned(
top: 0,
bottom: 0,
left: 0,
right: 0,
child: Icon(Icons.wrong_location_sharp,color: Colors.blue),
)
],
),
Expanded(
child: SingleChildScrollView(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论