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