release: 1.0.10
This commit is contained in:
@ -5,7 +5,6 @@ import 'package:amap_map_example/pages/interactive/map_ui_options.dart';
|
||||
import 'package:amap_map_example/pages/map/change_map_lang.dart';
|
||||
import 'package:amap_map_example/pages/map/limit_map_bounds.dart';
|
||||
import 'package:amap_map_example/pages/map/map_my_location.dart';
|
||||
import 'package:amap_map_example/pages/map/map_with_extension_page.dart';
|
||||
import 'package:amap_map_example/pages/map/show_map_page.dart';
|
||||
import 'package:amap_map_example/pages/overlays/custom_info_window.dart';
|
||||
import 'package:amap_map_example/pages/overlays/marker_config.dart';
|
||||
@ -19,8 +18,7 @@ class DemoConfiguration {
|
||||
final WidgetBuilder buildRoute;
|
||||
}
|
||||
|
||||
List<Demo> allDemos() =>
|
||||
mapDemos() + interactiveDemos() + overlayDemos() + extensionDemos();
|
||||
List<Demo> allDemos() => mapDemos() + interactiveDemos() + overlayDemos();
|
||||
|
||||
List<Demo> mapDemos() {
|
||||
return [
|
||||
@ -93,19 +91,6 @@ List<Demo> overlayDemos() {
|
||||
];
|
||||
}
|
||||
|
||||
List<Demo> extensionDemos() {
|
||||
return [
|
||||
Demo(
|
||||
title: '辅助信息获取',
|
||||
category: DemoCategory.extension,
|
||||
subtitle: '获取审图号',
|
||||
slug: 'extension-info',
|
||||
configurations: [
|
||||
DemoConfiguration(buildRoute: (context) => MapWithExtensionPage())
|
||||
])
|
||||
];
|
||||
}
|
||||
|
||||
Map<String?, Demo> slugToDemo(BuildContext context) {
|
||||
return LinkedHashMap<String?, Demo>.fromIterable(
|
||||
allDemos(),
|
||||
|
@ -79,13 +79,6 @@ class _AMapDemoState extends State<AMapDemo>
|
||||
category: DemoCategory.overlay,
|
||||
demos: overlayDemos(),
|
||||
)),
|
||||
AnimatedCategoryItem(
|
||||
startDelayFraction: 0.15,
|
||||
controller: _animationController,
|
||||
child: CategoryListItem(
|
||||
category: DemoCategory.extension,
|
||||
demos: extensionDemos(),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -1,81 +0,0 @@
|
||||
// Copyright 2023-2024 kuloud
|
||||
// Copyright 2020 lbs.amap.com
|
||||
|
||||
// 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,
|
||||
|
||||
// import 'package:amap_map_extensions/amap_map_extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
|
||||
class MapWithExtensionPage extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _MapWithExtensionPageState();
|
||||
}
|
||||
|
||||
class _MapWithExtensionPageState extends State<MapWithExtensionPage> {
|
||||
List<Widget> _approvalNumberWidget = <Widget>[];
|
||||
// final _extension = AmapMapExtensions();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AMapWidget map = AMapWidget(
|
||||
onMapCreated: onMapCreated,
|
||||
// extensions: [_extension],
|
||||
);
|
||||
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints.expand(),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: map,
|
||||
),
|
||||
Positioned(
|
||||
right: 10,
|
||||
bottom: 15,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: _approvalNumberWidget),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
late AMapController _mapController;
|
||||
void onMapCreated(AMapController controller) {
|
||||
setState(() {
|
||||
_mapController = controller;
|
||||
getApprovalNumber();
|
||||
});
|
||||
}
|
||||
|
||||
/// 获取审图号
|
||||
void getApprovalNumber() async {
|
||||
// //普通地图审图号
|
||||
// String mapContentApprovalNumber =
|
||||
// (await _extension.getMapContentApprovalNumber())!;
|
||||
// //卫星地图审图号
|
||||
// String satelliteImageApprovalNumber =
|
||||
// (await _extension.getSatelliteImageApprovalNumber())!;
|
||||
// setState(() {
|
||||
// _approvalNumberWidget.add(Text(mapContentApprovalNumber));
|
||||
// _approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
|
||||
// });
|
||||
// print('地图审图号(普通地图): $mapContentApprovalNumber');
|
||||
// print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
|
||||
}
|
||||
}
|
@ -43,23 +43,23 @@ class _ShowMapPageState extends State<ShowMapPage> {
|
||||
void onMapCreated(AMapController controller) {
|
||||
setState(() {
|
||||
_mapController = controller;
|
||||
// getApprovalNumber();
|
||||
getApprovalNumber();
|
||||
});
|
||||
}
|
||||
|
||||
/// 获取审图号
|
||||
void getApprovalNumber() async {
|
||||
// //普通地图审图号
|
||||
// String mapContentApprovalNumber =
|
||||
// (await _mapController.getMapContentApprovalNumber())!;
|
||||
// //卫星地图审图号
|
||||
// String satelliteImageApprovalNumber =
|
||||
// (await _mapController.getSatelliteImageApprovalNumber())!;
|
||||
// setState(() {
|
||||
// _approvalNumberWidget.add(Text(mapContentApprovalNumber));
|
||||
// _approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
|
||||
// });
|
||||
// print('地图审图号(普通地图): $mapContentApprovalNumber');
|
||||
// print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
|
||||
//普通地图审图号
|
||||
String mapContentApprovalNumber =
|
||||
(await _mapController.getMapContentApprovalNumber());
|
||||
//卫星地图审图号
|
||||
String satelliteImageApprovalNumber =
|
||||
(await _mapController.getSatelliteImageApprovalNumber());
|
||||
setState(() {
|
||||
_approvalNumberWidget.add(Text(mapContentApprovalNumber));
|
||||
_approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
|
||||
});
|
||||
print('地图审图号(普通地图): $mapContentApprovalNumber');
|
||||
print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
|
||||
}
|
||||
}
|
||||
|
@ -22,16 +22,13 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
BitmapDescriptor? _markerIcon;
|
||||
String? selectedMarkerId;
|
||||
bool showInfoWindow = false;
|
||||
AMapController? _controller;
|
||||
|
||||
final _infoWindowExtension = InfoWindowExtension(
|
||||
infoWindow: Container(
|
||||
color: Colors.lightBlue.shade400,
|
||||
child: Text('info'),
|
||||
),
|
||||
option: InfoWindowOption(
|
||||
latLng: mapCenter, offset: EdgeInsets.only(bottom: 32)));
|
||||
|
||||
Future<void> _onMapCreated(AMapController controller) async {}
|
||||
Future<void> _onMapCreated(AMapController controller) async {
|
||||
setState(() {
|
||||
_controller = controller;
|
||||
});
|
||||
}
|
||||
|
||||
void _add() {
|
||||
final int markerCount = _markers.length;
|
||||
@ -168,8 +165,8 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
setState(() {
|
||||
showInfoWindow = value;
|
||||
_markers[selectedMarkerId!] = marker.copyWith(
|
||||
// visibleParam: value,
|
||||
);
|
||||
visibleParam: value,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -190,14 +187,10 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
_markerIcon = BitmapDescriptor.fromIconPath('assets/location_marker.png');
|
||||
}
|
||||
|
||||
_infoWindowExtension.option?.show =
|
||||
_markers[selectedMarkerId] != null && showInfoWindow;
|
||||
_infoWindowExtension.option?.latLng = _markers[selectedMarkerId]?.position;
|
||||
|
||||
final AMapWidget map = AMapWidget(
|
||||
AMapWidget map = AMapWidget(
|
||||
onMapCreated: _onMapCreated,
|
||||
markers: Set<Marker>.of(_markers.values),
|
||||
extensions: [_infoWindowExtension],
|
||||
infoWindowAdapter: CustomInfoWindowAdapter(_controller, selectedMarkerId),
|
||||
);
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
@ -293,3 +286,43 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomInfoWindowAdapter extends BaseInfoWindowAdapter {
|
||||
CustomInfoWindowAdapter(AMapController? controller, this.selectedMarkerId)
|
||||
: super(controller);
|
||||
|
||||
final String? selectedMarkerId;
|
||||
|
||||
@override
|
||||
Widget? buildInfoWindowContent(BuildContext context, Marker marker) {
|
||||
if (marker.id != selectedMarkerId) {
|
||||
return null;
|
||||
}
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 4.0,
|
||||
spreadRadius: 2.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
marker.infoWindow.title ?? 'No Title',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
marker.infoWindow.snippet ?? 'No Snippet',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ description: Demonstrates how to use the amap_map plugin.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
environment:
|
||||
sdk: ">=3.1.5 <4.0.0"
|
||||
@ -16,20 +16,10 @@ dependencies:
|
||||
flutter_plugin_android_lifecycle: ^2.0.21
|
||||
|
||||
amap_map:
|
||||
# When depending on this package from a real application you should use:
|
||||
# amap_map: ^x.y.z
|
||||
# See https://dart.dev/tools/pub/dependencies#version-constraints
|
||||
# The example app is bundled with the plugin so we use a path dependency on
|
||||
# the parent directory to use the current plugin's version.
|
||||
path: ../
|
||||
x_common: ^1.0.4
|
||||
x_amap_base: ^1.0.3
|
||||
|
||||
# amap_map_extensions: ^0.0.1
|
||||
# amap_map_extensions:
|
||||
# path: ../../amap_map_extensions
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
@ -39,7 +29,6 @@ dev_dependencies:
|
||||
|
||||
# The following section is specific to Flutter.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
@ -51,5 +40,3 @@ flutter:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user