release: 1.0.12
This commit is contained in:
parent
43ecfb8ca1
commit
0a6e9c7119
|
@ -40,8 +40,8 @@ jobs:
|
|||
tag_name: v${{ steps.package_publisher.outputs.localVersion }}
|
||||
title: Release ${{ steps.package_publisher.outputs.localVersion }}
|
||||
body: |
|
||||
Automated release for version ${{ steps.package_publisher.outputs.localVersion }}
|
||||
Changes in this release:
|
||||
Automated release for version ${{ steps.package_publisher.outputs.localVersion }}\n
|
||||
Changes in this release:\n
|
||||
${{ env.git_log }}
|
||||
draft: false
|
||||
prerelease: false
|
|
@ -1,3 +1,7 @@
|
|||
## 1.0.12
|
||||
2024-08-26
|
||||
* code lint
|
||||
|
||||
## 1.0.11
|
||||
2024-08-25
|
||||
* 升级amap iOS sdk版本 10.0.900 | 2024-08-23
|
||||
|
|
|
@ -172,7 +172,6 @@ class _CategoryHeader extends StatelessWidget {
|
|||
margin: margin,
|
||||
child: Material(
|
||||
shape: RoundedRectangleBorder(borderRadius: borderRadius),
|
||||
color: colorScheme.onBackground,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
|
@ -198,10 +197,7 @@ class _CategoryHeader extends StatelessWidget {
|
|||
padding: const EdgeInsetsDirectional.only(start: 8),
|
||||
child: Text(
|
||||
category.toDisplayTitle(),
|
||||
style:
|
||||
Theme.of(context).textTheme.headlineMedium!.apply(
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -268,7 +264,6 @@ class CategoryDemoItem extends StatelessWidget {
|
|||
return Material(
|
||||
// Makes integration tests possible.
|
||||
key: ValueKey(demo.describe),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: MergeSemantics(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
|
@ -292,8 +287,7 @@ class CategoryDemoItem extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
demo.title,
|
||||
style: textTheme.titleMedium!
|
||||
.apply(color: colorScheme.onSurface),
|
||||
style: textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
demo.subtitle,
|
||||
|
@ -305,7 +299,7 @@ class CategoryDemoItem extends StatelessWidget {
|
|||
Divider(
|
||||
thickness: 1,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:amap_map_example/category_list_item.dart';
|
|||
import 'package:amap_map_example/const_config.dart';
|
||||
import 'package:amap_map_example/data/demos.dart';
|
||||
import 'package:amap_map_example/routes.dart';
|
||||
import 'package:amap_map_example/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
|
@ -95,7 +94,6 @@ class _AMapDemoState extends State<AMapDemo>
|
|||
|
||||
void main() {
|
||||
runApp(MaterialApp(
|
||||
theme: ThemeData(colorScheme: DemoThemeData.lightColorScheme),
|
||||
themeMode: ThemeMode.light,
|
||||
onGenerateRoute: RouteConfig.onGenerateRoute,
|
||||
home: AMapDemo()));
|
||||
|
|
|
@ -4,10 +4,10 @@ import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class GesturesDemoPage extends StatefulWidget {
|
||||
GesturesDemoPage({Key? key}) : super(key: key);
|
||||
GesturesDemoPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<GesturesDemoPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<GesturesDemoPage> {
|
||||
|
@ -71,7 +71,7 @@ class _BodyState extends State<GesturesDemoPage> {
|
|||
},
|
||||
),
|
||||
];
|
||||
Widget _gesturesOptiosWeidget() {
|
||||
Widget gesturesOptiosWeidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -103,7 +103,7 @@ class _BodyState extends State<GesturesDemoPage> {
|
|||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: _gesturesOptiosWeidget(),
|
||||
child: gesturesOptiosWeidget(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -6,10 +6,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
||||
class MapUIDemoPage extends StatefulWidget {
|
||||
MapUIDemoPage({Key? key}) : super(key: key);
|
||||
MapUIDemoPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MapUIDemoPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MapUIDemoPage> {
|
||||
|
@ -52,7 +52,7 @@ class _BodyState extends State<MapUIDemoPage> {
|
|||
);
|
||||
|
||||
//ui控制
|
||||
final List<Widget> _uiOptions = [
|
||||
final List<Widget> uiOptions = [
|
||||
AMapSwitchButton(
|
||||
label: Text('显示路况'),
|
||||
defaultValue: _trafficEnabled,
|
||||
|
@ -100,7 +100,7 @@ class _BodyState extends State<MapUIDemoPage> {
|
|||
),
|
||||
];
|
||||
|
||||
Widget _uiOptionsWidget() {
|
||||
Widget uiOptionsWidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -110,7 +110,7 @@ class _BodyState extends State<MapUIDemoPage> {
|
|||
Text('UI操作', style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: AMapGradView(childrenWidgets: _uiOptions),
|
||||
child: AMapGradView(childrenWidgets: uiOptions),
|
||||
),
|
||||
AMapRadioGroup<LogoPosition?>(
|
||||
groupLabel: 'Logo位置',
|
||||
|
@ -169,7 +169,7 @@ class _BodyState extends State<MapUIDemoPage> {
|
|||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: _uiOptionsWidget(),
|
||||
child: uiOptionsWidget(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -4,10 +4,10 @@ import 'package:amap_map_example/widgets/amap_gridview.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class MoveCameraDemoPage extends StatefulWidget {
|
||||
MoveCameraDemoPage({Key? key}) : super(key: key);
|
||||
MoveCameraDemoPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MoveCameraDemoPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MoveCameraDemoPage> {
|
||||
|
@ -20,14 +20,14 @@ class _BodyState extends State<MoveCameraDemoPage> {
|
|||
onCameraMove: _onCameraMove,
|
||||
onCameraMoveEnd: _onCameraMoveEnd,
|
||||
);
|
||||
List<Widget> _optionsWidget = [
|
||||
List<Widget> optionsWidget = [
|
||||
_createMyFloatButton('改变显示区域', _changeLatLngBounds),
|
||||
_createMyFloatButton('改变中心点', _changeCameraPosition),
|
||||
_createMyFloatButton('改变缩放级别到18', _changeCameraZoom),
|
||||
_createMyFloatButton('按照像素移动地图', _scrollBy),
|
||||
];
|
||||
|
||||
Widget _cameraOptions() {
|
||||
Widget cameraOptions() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -36,7 +36,7 @@ class _BodyState extends State<MoveCameraDemoPage> {
|
|||
children: [
|
||||
Container(
|
||||
child: AMapGradView(
|
||||
childrenWidgets: _optionsWidget,
|
||||
childrenWidgets: optionsWidget,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -112,7 +112,7 @@ class _BodyState extends State<MoveCameraDemoPage> {
|
|||
)
|
||||
: SizedBox(),
|
||||
Container(
|
||||
child: _cameraOptions(),
|
||||
child: cameraOptions(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -204,16 +204,16 @@ class _BodyState extends State<MoveCameraDemoPage> {
|
|||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -3,10 +3,10 @@ import 'package:x_amap_base/x_amap_base.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class PoiClickDemoPage extends StatefulWidget {
|
||||
PoiClickDemoPage({Key? key}) : super(key: key);
|
||||
PoiClickDemoPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<PoiClickDemoPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<PoiClickDemoPage> {
|
||||
|
|
|
@ -32,16 +32,16 @@ class _SnapShotState extends State<SnapshotPage> {
|
|||
child: TextButton(
|
||||
child: Text('截屏'),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -14,10 +14,10 @@ import 'package:amap_map_example/widgets/amap_radio_group.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChangeMapLangPage extends StatefulWidget {
|
||||
ChangeMapLangPage({Key? key}) : super(key: key);
|
||||
ChangeMapLangPage({super.key});
|
||||
|
||||
@override
|
||||
_PageBodyState createState() => _PageBodyState();
|
||||
State<ChangeMapLangPage> createState() => _PageBodyState();
|
||||
}
|
||||
|
||||
class _PageBodyState extends State<ChangeMapLangPage> {
|
||||
|
|
|
@ -3,10 +3,10 @@ import 'package:amap_map_example/widgets/amap_radio_group.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChangeMapTypePage extends StatefulWidget {
|
||||
ChangeMapTypePage({Key? key}) : super(key: key);
|
||||
ChangeMapTypePage({super.key});
|
||||
|
||||
@override
|
||||
_PageBodyState createState() => _PageBodyState();
|
||||
State<ChangeMapTypePage> createState() => _PageBodyState();
|
||||
}
|
||||
|
||||
class _PageBodyState extends State<ChangeMapTypePage> {
|
||||
|
|
|
@ -4,16 +4,16 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
|
||||
class CustomMapStylePage extends StatefulWidget {
|
||||
CustomMapStylePage({Key? key}) : super(key: key);
|
||||
CustomMapStylePage({super.key});
|
||||
|
||||
@override
|
||||
_CustomMapStyleState createState() => _CustomMapStyleState();
|
||||
State<CustomMapStylePage> createState() => _CustomMapStyleState();
|
||||
}
|
||||
|
||||
class _CustomMapStyleState extends State<CustomMapStylePage> {
|
||||
bool _mapCreated = false;
|
||||
|
||||
CustomStyleOptions _customStyleOptions = CustomStyleOptions(false);
|
||||
final CustomStyleOptions _customStyleOptions = CustomStyleOptions(false);
|
||||
//加载自定义地图样式
|
||||
void _loadCustomData() async {
|
||||
ByteData styleByteData = await rootBundle.load('assets/style.data');
|
||||
|
|
|
@ -3,10 +3,10 @@ import 'package:x_amap_base/x_amap_base.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class LimitMapBoundsPage extends StatefulWidget {
|
||||
LimitMapBoundsPage({Key? key}) : super(key: key);
|
||||
LimitMapBoundsPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<LimitMapBoundsPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<LimitMapBoundsPage> {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -54,10 +52,10 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
|
||||
late AMapController _controller;
|
||||
|
||||
CustomStyleOptions _customStyleOptions = CustomStyleOptions(false);
|
||||
final CustomStyleOptions _customStyleOptions = CustomStyleOptions(false);
|
||||
|
||||
///自定义定位小蓝点
|
||||
MyLocationStyleOptions _myLocationStyleOptions =
|
||||
final MyLocationStyleOptions _myLocationStyleOptions =
|
||||
MyLocationStyleOptions(false);
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -100,7 +98,7 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
onPoiTouched: _onMapPoiTouched,
|
||||
);
|
||||
|
||||
Widget _mapTypeRadio(String label, MapType radioValue) {
|
||||
Widget mapTypeRadio(String label, MapType radioValue) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
@ -118,16 +116,16 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
);
|
||||
}
|
||||
|
||||
final List<Widget> _mapTypeList = [
|
||||
_mapTypeRadio('普通地图', MapType.normal),
|
||||
_mapTypeRadio('卫星地图', MapType.satellite),
|
||||
_mapTypeRadio('导航地图', MapType.navi),
|
||||
_mapTypeRadio('公交地图', MapType.bus),
|
||||
_mapTypeRadio('黑夜模式', MapType.night),
|
||||
final List<Widget> mapTypeList = [
|
||||
mapTypeRadio('普通地图', MapType.normal),
|
||||
mapTypeRadio('卫星地图', MapType.satellite),
|
||||
mapTypeRadio('导航地图', MapType.navi),
|
||||
mapTypeRadio('公交地图', MapType.bus),
|
||||
mapTypeRadio('黑夜模式', MapType.night),
|
||||
];
|
||||
|
||||
//ui控制
|
||||
final List<Widget> _uiOptions = [
|
||||
final List<Widget> uiOptions = [
|
||||
AMapSwitchButton(
|
||||
label: Text('显示路况'),
|
||||
defaultValue: _trafficEnabled,
|
||||
|
@ -233,7 +231,7 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
),
|
||||
];
|
||||
|
||||
Widget _mapTypeOptions() {
|
||||
Widget mapTypeOptions() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -243,14 +241,14 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
Text('地图样式', style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: createGridView(_mapTypeList),
|
||||
child: createGridView(mapTypeList),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _myLocationStyleContainer() {
|
||||
Widget myLocationStyleContainer() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Row(
|
||||
|
@ -273,7 +271,7 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _uiOptionsWidget() {
|
||||
Widget uiOptionsWidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -283,14 +281,14 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
Text('UI操作', style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: createGridView(_uiOptions),
|
||||
child: createGridView(uiOptions),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _gesturesOptiosWeidget() {
|
||||
Widget gesturesOptiosWeidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
|
@ -307,13 +305,13 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _optionsItem() {
|
||||
Widget optionsItem() {
|
||||
return Column(
|
||||
children: [
|
||||
_mapTypeOptions(),
|
||||
_myLocationStyleContainer(),
|
||||
_uiOptionsWidget(),
|
||||
_gesturesOptiosWeidget(),
|
||||
mapTypeOptions(),
|
||||
myLocationStyleContainer(),
|
||||
uiOptionsWidget(),
|
||||
gesturesOptiosWeidget(),
|
||||
TextButton(
|
||||
child: const Text('moveCamera到首开'),
|
||||
onPressed: _moveCameraToShoukai,
|
||||
|
@ -337,7 +335,7 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: _optionsItem(),
|
||||
child: optionsItem(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -366,7 +364,7 @@ class _MapUiBodyState extends State<AllMapConfigDemoPage> {
|
|||
Widget createGridView(List<Widget> widgets) {
|
||||
return GridView.count(
|
||||
primary: false,
|
||||
physics: new NeverScrollableScrollPhysics(),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
//水平子Widget之间间距
|
||||
crossAxisSpacing: 1.0,
|
||||
//垂直子Widget之间间距
|
||||
|
|
|
@ -3,9 +3,9 @@ import 'package:flutter/material.dart';
|
|||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class MyLocationPage extends StatefulWidget {
|
||||
MyLocationPage({Key? key}) : super(key: key);
|
||||
MyLocationPage({super.key});
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MyLocationPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MyLocationPage> {
|
||||
|
|
|
@ -2,10 +2,10 @@ import 'package:amap_map/amap_map.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class MinMaxZoomDemoPage extends StatefulWidget {
|
||||
MinMaxZoomDemoPage({Key? key}) : super(key: key);
|
||||
MinMaxZoomDemoPage({super.key});
|
||||
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MinMaxZoomDemoPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MinMaxZoomDemoPage> {
|
||||
|
|
|
@ -8,7 +8,7 @@ class ShowMapPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ShowMapPageState extends State<ShowMapPage> {
|
||||
List<Widget> _approvalNumberWidget = <Widget>[];
|
||||
final List<Widget> _approvalNumberWidget = <Widget>[];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AMapWidget map = AMapWidget(
|
||||
|
|
|
@ -18,7 +18,7 @@ class CustomInfoWindowDemoPage extends StatefulWidget {
|
|||
class _State extends State<CustomInfoWindowDemoPage> {
|
||||
static final LatLng mapCenter = const LatLng(39.909187, 116.397451);
|
||||
|
||||
Map<String, Marker> _markers = <String, Marker>{};
|
||||
final Map<String, Marker> _markers = <String, Marker>{};
|
||||
BitmapDescriptor? _markerIcon;
|
||||
String? selectedMarkerId;
|
||||
bool showInfoWindow = false;
|
||||
|
@ -77,7 +77,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
|||
}
|
||||
|
||||
void _removeAll() {
|
||||
if (_markers.length > 0) {
|
||||
if (_markers.isNotEmpty) {
|
||||
setState(() {
|
||||
_markers.clear();
|
||||
selectedMarkerId = null.toString();
|
||||
|
@ -87,7 +87,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
|||
|
||||
void _changeInfo() async {
|
||||
final Marker marker = _markers[selectedMarkerId]!;
|
||||
final String newTitle = marker.infoWindow.title! + '*';
|
||||
final String newTitle = '${marker.infoWindow.title!}*';
|
||||
if (selectedMarkerId != null) {
|
||||
setState(() {
|
||||
_markers[selectedMarkerId!] = marker.copyWith(
|
||||
|
@ -183,9 +183,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
|||
Widget build(BuildContext context) {
|
||||
///以下几种获取自定图片的方式使用其中一种即可。
|
||||
//最简单的方式
|
||||
if (null == _markerIcon) {
|
||||
_markerIcon = BitmapDescriptor.fromIconPath('assets/location_marker.png');
|
||||
}
|
||||
_markerIcon ??= BitmapDescriptor.fromIconPath('assets/location_marker.png');
|
||||
|
||||
AMapWidget map = AMapWidget(
|
||||
onMapCreated: _onMapCreated,
|
||||
|
@ -245,7 +243,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
|||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('全部移除'),
|
||||
onPressed: _markers.length > 0 ? _removeAll : null,
|
||||
onPressed: _markers.isNotEmpty ? _removeAll : null,
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('允许拖动'),
|
||||
|
@ -288,8 +286,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
|||
}
|
||||
|
||||
class CustomInfoWindowAdapter extends BaseInfoWindowAdapter {
|
||||
CustomInfoWindowAdapter(AMapController? controller, this.selectedMarkerId)
|
||||
: super(controller);
|
||||
CustomInfoWindowAdapter(super.controller, this.selectedMarkerId);
|
||||
|
||||
final String? selectedMarkerId;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class MarkerAddAfterMapPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MarkerAddAfterMapPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MarkerAddAfterMapPage> {
|
||||
|
@ -14,16 +14,16 @@ class _BodyState extends State<MarkerAddAfterMapPage> {
|
|||
LatLng _currentLatLng = defaultPosition;
|
||||
//添加一个marker
|
||||
void _addMarker() {
|
||||
final _markerPosition =
|
||||
final markerPosition =
|
||||
LatLng(_currentLatLng.latitude, _currentLatLng.longitude + 2 / 1000);
|
||||
final Marker marker = Marker(
|
||||
position: _markerPosition,
|
||||
position: markerPosition,
|
||||
//使用默认hue的方式设置Marker的图标
|
||||
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueOrange),
|
||||
);
|
||||
//调用setState触发AMapWidget的更新,从而完成marker的添加
|
||||
setState(() {
|
||||
_currentLatLng = _markerPosition;
|
||||
_currentLatLng = markerPosition;
|
||||
//将新的marker添加到map里
|
||||
_markers[marker.id] = marker;
|
||||
});
|
||||
|
@ -33,16 +33,16 @@ class _BodyState extends State<MarkerAddAfterMapPage> {
|
|||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class MarkerAddWithMapPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MarkerAddWithMapPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MarkerAddWithMapPage> {
|
||||
|
|
|
@ -19,7 +19,7 @@ class MarkerConfigDemoPage extends StatefulWidget {
|
|||
class _State extends State<MarkerConfigDemoPage> {
|
||||
static final LatLng mapCenter = const LatLng(39.909187, 116.397451);
|
||||
|
||||
Map<String, Marker> _markers = <String, Marker>{};
|
||||
final Map<String, Marker> _markers = <String, Marker>{};
|
||||
BitmapDescriptor? _markerIcon;
|
||||
String? selectedMarkerId;
|
||||
|
||||
|
@ -27,11 +27,11 @@ class _State extends State<MarkerConfigDemoPage> {
|
|||
LatLng latLng = LatLng(mapCenter.latitude + sin(pi / 12.0) / 20.0,
|
||||
mapCenter.longitude + cos(pi / 12.0) / 20.0);
|
||||
try {
|
||||
print('-latLng---------${latLng}');
|
||||
print('-latLng---------$latLng');
|
||||
ScreenCoordinate coordinate = await controller.toScreenCoordinate(latLng);
|
||||
print('-coordinate---------${coordinate}');
|
||||
print('-coordinate---------$coordinate');
|
||||
LatLng reLatLng = await controller.fromScreenCoordinate(coordinate);
|
||||
print('-reLatLng---------${reLatLng}');
|
||||
print('-reLatLng---------$reLatLng');
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class _State extends State<MarkerConfigDemoPage> {
|
|||
}
|
||||
|
||||
void _removeAll() {
|
||||
if (_markers.length > 0) {
|
||||
if (_markers.isNotEmpty) {
|
||||
setState(() {
|
||||
_markers.clear();
|
||||
selectedMarkerId = null.toString();
|
||||
|
@ -129,7 +129,7 @@ class _State extends State<MarkerConfigDemoPage> {
|
|||
|
||||
void _changeInfo() async {
|
||||
final Marker marker = _markers[selectedMarkerId]!;
|
||||
final String newTitle = marker.infoWindow.title! + '*';
|
||||
final String newTitle = '${marker.infoWindow.title!}*';
|
||||
if (selectedMarkerId != null) {
|
||||
setState(() {
|
||||
_markers[selectedMarkerId!] = marker.copyWith(
|
||||
|
@ -233,14 +233,12 @@ class _State extends State<MarkerConfigDemoPage> {
|
|||
Widget build(BuildContext context) {
|
||||
///以下几种获取自定图片的方式使用其中一种即可。
|
||||
//最简单的方式
|
||||
if (null == _markerIcon) {
|
||||
_markerIcon = BitmapDescriptor.fromIconPath('assets/location_marker.png');
|
||||
}
|
||||
_markerIcon ??= BitmapDescriptor.fromIconPath('assets/location_marker.png');
|
||||
|
||||
//通过BitmapDescriptor.fromAssetImage的方式获取图片
|
||||
// _createMarkerImageFromAsset(context);
|
||||
_createMarkerImageFromAsset(context);
|
||||
//通过BitmapDescriptor.fromBytes的方式获取图片
|
||||
// _createMarkerImageFromBytes(context);
|
||||
_createMarkerImageFromBytes(context);
|
||||
|
||||
final AMapWidget map = AMapWidget(
|
||||
onMapCreated: _onMapCreated,
|
||||
|
@ -299,7 +297,7 @@ class _State extends State<MarkerConfigDemoPage> {
|
|||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('全部移除'),
|
||||
onPressed: _markers.length > 0 ? _removeAll : null,
|
||||
onPressed: _markers.isNotEmpty ? _removeAll : null,
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('允许拖动'),
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class MarkerCustomIconPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
State<MarkerCustomIconPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MarkerCustomIconPage> {
|
||||
|
@ -42,16 +42,16 @@ class _BodyState extends State<MarkerCustomIconPage> {
|
|||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
@ -24,7 +23,7 @@ class _State extends State<PolygonDemoPage> {
|
|||
Colors.pink,
|
||||
];
|
||||
|
||||
Map<String, Polygon> _polygons = <String, Polygon>{};
|
||||
final Map<String, Polygon> _polygons = <String, Polygon>{};
|
||||
String? selectedPolygonId;
|
||||
|
||||
void _onMapCreated(AMapController controller) {}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
@ -23,7 +22,7 @@ class _State extends State<PolylineDemoPage> {
|
|||
Colors.green,
|
||||
Colors.pink,
|
||||
];
|
||||
Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
final Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
String? selectedPolylineId;
|
||||
|
||||
void _onMapCreated(AMapController controller) {}
|
||||
|
@ -64,7 +63,7 @@ class _State extends State<PolylineDemoPage> {
|
|||
}
|
||||
|
||||
void _changeWidth() {
|
||||
final Polyline? selectedPolyline = _polylines[selectedPolylineId]!;
|
||||
final Polyline? selectedPolyline = _polylines[selectedPolylineId];
|
||||
//有选中的Polyline
|
||||
if (selectedPolyline != null) {
|
||||
double currentWidth = selectedPolyline.width;
|
||||
|
@ -109,7 +108,7 @@ class _State extends State<PolylineDemoPage> {
|
|||
}
|
||||
|
||||
void _changeCapType() {
|
||||
final Polyline? polyline = _polylines[selectedPolylineId]!;
|
||||
final Polyline? polyline = _polylines[selectedPolylineId];
|
||||
if (polyline == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
@ -22,7 +21,7 @@ class _State extends State<PolylineGeodesicDemoPage> {
|
|||
Colors.green,
|
||||
Colors.pink,
|
||||
];
|
||||
Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
final Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
late String selectedPolylineId;
|
||||
AMapController? _controller;
|
||||
|
||||
|
@ -89,16 +88,16 @@ class _State extends State<PolylineGeodesicDemoPage> {
|
|||
child: TextButton(
|
||||
onPressed: _add,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -13,7 +13,7 @@ class PolylineTextureDemoPage extends StatefulWidget {
|
|||
class _State extends State<PolylineTextureDemoPage> {
|
||||
_State();
|
||||
|
||||
Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
final Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
late String selectedPolylineId;
|
||||
|
||||
void _onMapCreated(AMapController controller) {}
|
||||
|
@ -76,16 +76,16 @@ class _State extends State<PolylineTextureDemoPage> {
|
|||
child: TextButton(
|
||||
onPressed: _add,
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
//文字颜色
|
||||
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
//水波纹颜色
|
||||
overlayColor: MaterialStateProperty.all(Colors.blueAccent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.blueAccent),
|
||||
//背景颜色
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.blueAccent;
|
||||
}
|
||||
//默认背景颜色
|
||||
|
|
|
@ -23,7 +23,7 @@ class Path {
|
|||
}
|
||||
|
||||
class RouteConfig {
|
||||
static List<Path> _paths = [
|
||||
static final List<Path> _paths = [
|
||||
Path(
|
||||
r'^/([\w-]+)$',
|
||||
(context, match) => DemoPage(slug: match),
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class DemoThemeData {
|
||||
static const _lightFillColor = Colors.black;
|
||||
static const ColorScheme lightColorScheme = ColorScheme(
|
||||
primary: Color(0xFFB93C5D),
|
||||
primaryContainer: Color(0xFF117378),
|
||||
secondary: Color(0xFFEFF3F3),
|
||||
secondaryContainer: Color(0xFFFAFBFB),
|
||||
background: Color(0xFFE6EBEB),
|
||||
surface: Color(0xFFFAFBFB),
|
||||
onBackground: Colors.white,
|
||||
error: _lightFillColor,
|
||||
onError: _lightFillColor,
|
||||
onPrimary: _lightFillColor,
|
||||
onSecondary: Color(0xFF322942),
|
||||
onSurface: Color(0xFF241E30),
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
}
|
|
@ -16,7 +16,7 @@ class AMapGradView extends StatefulWidget {
|
|||
this.childAspectRatio,
|
||||
required this.childrenWidgets});
|
||||
@override
|
||||
_GradViewState createState() => _GradViewState();
|
||||
State<AMapGradView> createState() => _GradViewState();
|
||||
}
|
||||
|
||||
class _GradViewState extends State<AMapGradView> {
|
||||
|
|
|
@ -14,7 +14,7 @@ class AMapRadioGroup<T> extends StatefulWidget {
|
|||
this.onChanged});
|
||||
|
||||
@override
|
||||
_AMapRadioGroupState<T> createState() => _AMapRadioGroupState<T>();
|
||||
State<AMapRadioGroup<T>> createState() => _AMapRadioGroupState<T>();
|
||||
}
|
||||
|
||||
class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
|
||||
|
|
|
@ -223,7 +223,7 @@ class _MapState extends State<AMapWidget> {
|
|||
@override
|
||||
void deactivate() async {
|
||||
super.deactivate();
|
||||
print('deactivate AMapWidget}');
|
||||
print('deactivate AMapWidget');
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,27 +1,42 @@
|
|||
/// 地图覆盖物基类
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class BaseOverlay {
|
||||
/// overlay id
|
||||
late String _id;
|
||||
String _id;
|
||||
|
||||
String get id => _id;
|
||||
|
||||
BaseOverlay() {
|
||||
_id = hashCode.toString();
|
||||
// 初始化 _id,在创建对象时唯一确定
|
||||
BaseOverlay() : _id = _generateUniqueId();
|
||||
|
||||
// 设置复制的 ID,确保拷贝对象时的唯一性或保留性
|
||||
void setIdForCopy(String copyId) {
|
||||
if (copyId.isNotEmpty) {
|
||||
_id = copyId;
|
||||
} else {
|
||||
throw ArgumentError('Invalid ID for copy');
|
||||
}
|
||||
}
|
||||
|
||||
void setIdForCopy(String copyId) => _id = copyId;
|
||||
|
||||
// 克隆对象,确保子类正确实现 clone 方法
|
||||
BaseOverlay clone() {
|
||||
throw UnimplementedError(
|
||||
'BaseOverlay subClass should implement this methed.');
|
||||
'BaseOverlay subClass should implement this method.');
|
||||
}
|
||||
|
||||
// 将对象转换为 map 表示
|
||||
Map<String, dynamic> toMap() {
|
||||
throw UnimplementedError(
|
||||
'BaseOverlay subClass should implement this methed.');
|
||||
'BaseOverlay subClass should implement this method.');
|
||||
}
|
||||
|
||||
// 生成唯一 ID 的静态方法
|
||||
static String _generateUniqueId() {
|
||||
return '${DateTime.now().millisecondsSinceEpoch}_${UniqueKey()}';
|
||||
}
|
||||
}
|
||||
|
||||
// 序列化覆盖物集合
|
||||
List<Map<String, dynamic>>? serializeOverlaySet(Set<BaseOverlay> overlays) {
|
||||
return overlays
|
||||
.map<Map<String, dynamic>>((BaseOverlay overlay) => overlay.toMap())
|
||||
|
|
|
@ -245,6 +245,17 @@ class Marker extends BaseOverlay {
|
|||
@override
|
||||
int get hashCode => Object.hashAll([
|
||||
id,
|
||||
alpha,
|
||||
anchor,
|
||||
clickable,
|
||||
draggable,
|
||||
icon,
|
||||
infoWindowEnable,
|
||||
infoWindow,
|
||||
position,
|
||||
rotation,
|
||||
visible,
|
||||
zIndex
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,9 +100,8 @@ class Polygon extends BaseOverlay {
|
|||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([
|
||||
id,
|
||||
]);
|
||||
int get hashCode => Object.hashAll(
|
||||
[id, points, strokeWidth, strokeColor, fillColor, visible, joinType]);
|
||||
|
||||
dynamic _pointsToJson() {
|
||||
final List<dynamic> result = <dynamic>[];
|
||||
|
|
|
@ -188,6 +188,15 @@ class Polyline extends BaseOverlay {
|
|||
@override
|
||||
int get hashCode => Object.hashAll([
|
||||
id,
|
||||
points,
|
||||
width,
|
||||
visible,
|
||||
geodesic,
|
||||
alpha,
|
||||
dashLineType,
|
||||
capType,
|
||||
joinType,
|
||||
color
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: amap_map
|
||||
description: Amap SDK Flutter plugin for integrating AMapSDK in iOS and Android applications.
|
||||
version: 1.0.11
|
||||
version: 1.0.12
|
||||
homepage: https://github.com/kuloud/amap_map
|
||||
issue_tracker: https://github.com/kuloud/amap_map/issues
|
||||
platforms:
|
||||
|
|
Loading…
Reference in New Issue