chore: code lint
This commit is contained in:
@ -39,8 +39,8 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
position: markPostion,
|
||||
icon: _markerIcon!,
|
||||
infoWindow: InfoWindow(title: '第 $markerCount 个Marker'),
|
||||
onTap: (markerId) => _onMarkerTapped(markerId),
|
||||
onDragEnd: (markerId, endPosition) =>
|
||||
onTap: (String markerId) => _onMarkerTapped(markerId),
|
||||
onDragEnd: (String markerId, LatLng endPosition) =>
|
||||
_onMarkerDragEnd(markerId, endPosition),
|
||||
);
|
||||
|
||||
@ -196,7 +196,7 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
@ -212,64 +212,64 @@ class _State extends State<CustomInfoWindowDemoPage> {
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('添加'),
|
||||
onPressed: _add,
|
||||
child: const Text('添加'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('移除'),
|
||||
onPressed:
|
||||
(selectedMarkerId == null) ? null : _remove,
|
||||
child: const Text('移除'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('更新InfoWidow'),
|
||||
onPressed:
|
||||
(selectedMarkerId == null) ? null : _changeInfo,
|
||||
child: const Text('更新InfoWidow'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改锚点'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeAnchor,
|
||||
child: const Text('修改锚点'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改透明度'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeAlpha,
|
||||
child: const Text('修改透明度'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('全部移除'),
|
||||
onPressed: _markers.isNotEmpty ? _removeAll : null,
|
||||
child: const Text('全部移除'),
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('允许拖动'),
|
||||
label: const Text('允许拖动'),
|
||||
onSwitchChanged: (selectedMarkerId == null)
|
||||
? null
|
||||
: _toggleDraggable,
|
||||
defaultValue: false,
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('显示'),
|
||||
label: const Text('显示'),
|
||||
onSwitchChanged: (selectedMarkerId == null)
|
||||
? null
|
||||
: _toggleVisible,
|
||||
defaultValue: true,
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改坐标'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changePosition,
|
||||
child: const Text('修改坐标'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改旋转角度'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeRotation,
|
||||
child: const Text('修改旋转角度'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -300,8 +300,8 @@ class CustomInfoWindowAdapter extends BaseInfoWindowAdapter {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
boxShadow: <BoxShadow>[
|
||||
const BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 4.0,
|
||||
spreadRadius: 2.0,
|
||||
@ -310,10 +310,10 @@ class CustomInfoWindowAdapter extends BaseInfoWindowAdapter {
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
marker.infoWindow.title ?? 'No Title',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
marker.infoWindow.snippet ?? 'No Snippet',
|
||||
|
@ -266,64 +266,64 @@ class _State extends State<MarkerConfigDemoPage> {
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('添加'),
|
||||
onPressed: _add,
|
||||
child: const Text('添加'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('移除'),
|
||||
onPressed:
|
||||
(selectedMarkerId == null) ? null : _remove,
|
||||
child: const Text('移除'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('更新InfoWidow'),
|
||||
onPressed:
|
||||
(selectedMarkerId == null) ? null : _changeInfo,
|
||||
child: const Text('更新InfoWidow'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改锚点'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeAnchor,
|
||||
child: const Text('修改锚点'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改透明度'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeAlpha,
|
||||
child: const Text('修改透明度'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('全部移除'),
|
||||
onPressed: _markers.isNotEmpty ? _removeAll : null,
|
||||
child: const Text('全部移除'),
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('允许拖动'),
|
||||
label: const Text('允许拖动'),
|
||||
onSwitchChanged: (selectedMarkerId == null)
|
||||
? null
|
||||
: _toggleDraggable,
|
||||
defaultValue: false,
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('显示'),
|
||||
label: const Text('显示'),
|
||||
onSwitchChanged: (selectedMarkerId == null)
|
||||
? null
|
||||
: _toggleVisible,
|
||||
defaultValue: true,
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改坐标'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changePosition,
|
||||
child: const Text('修改坐标'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改旋转角度'),
|
||||
onPressed: (selectedMarkerId == null)
|
||||
? null
|
||||
: _changeRotation,
|
||||
child: const Text('修改旋转角度'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -3,17 +3,19 @@ import 'package:x_amap_base/x_amap_base.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MarkerCustomIconPage extends StatefulWidget {
|
||||
const MarkerCustomIconPage({super.key});
|
||||
|
||||
@override
|
||||
State<MarkerCustomIconPage> createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<MarkerCustomIconPage> {
|
||||
static final LatLng markerPosition = const LatLng(39.909187, 116.397451);
|
||||
static const LatLng markerPosition = LatLng(39.909187, 116.397451);
|
||||
final Map<String, Marker> _initMarkerMap = <String, Marker>{};
|
||||
String? _currentMarkerId;
|
||||
bool _hasInitMarker = false;
|
||||
static final String _startIconPath = 'assets/start.png';
|
||||
static final String _endIconPath = 'assets/end.png';
|
||||
static const String _startIconPath = 'assets/start.png';
|
||||
static const String _endIconPath = 'assets/end.png';
|
||||
String _iconPath = _startIconPath;
|
||||
void _initMarker(BuildContext context) async {
|
||||
if (_hasInitMarker) {
|
||||
|
@ -110,7 +110,7 @@ class _State extends State<PolygonDemoPage> {
|
||||
List<LatLng> currentPoints = polygon.points;
|
||||
List<LatLng> newPoints = <LatLng>[];
|
||||
newPoints.addAll(currentPoints);
|
||||
newPoints.add(LatLng(39.828809, 116.360364));
|
||||
newPoints.add(const LatLng(39.828809, 116.360364));
|
||||
|
||||
setState(() {
|
||||
_polygons[selectedPolygonId!] = polygon.copyWith(
|
||||
@ -133,7 +133,7 @@ class _State extends State<PolygonDemoPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final AMapWidget map = AMapWidget(
|
||||
initialCameraPosition:
|
||||
CameraPosition(target: LatLng(39.828809, 116.360364), zoom: 13),
|
||||
const CameraPosition(target: LatLng(39.828809, 116.360364), zoom: 13),
|
||||
onMapCreated: _onMapCreated,
|
||||
polygons: Set<Polygon>.of(_polygons.values),
|
||||
);
|
||||
@ -159,42 +159,42 @@ class _State extends State<PolygonDemoPage> {
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('添加'),
|
||||
onPressed: _add,
|
||||
child: const Text('添加'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('删除'),
|
||||
onPressed:
|
||||
(selectedPolygonId == null) ? null : _remove,
|
||||
child: const Text('删除'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改边框宽度'),
|
||||
onPressed: (selectedPolygonId == null)
|
||||
? null
|
||||
: _changeStrokeWidth,
|
||||
child: const Text('修改边框宽度'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('修改边框和填充色'),
|
||||
onPressed: (selectedPolygonId == null)
|
||||
? null
|
||||
: _changeColors,
|
||||
child: const Text('修改边框和填充色'),
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('显示'),
|
||||
label: const Text('显示'),
|
||||
onSwitchChanged: (selectedPolygonId == null)
|
||||
? null
|
||||
: _toggleVisible,
|
||||
defaultValue: true,
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改坐标'),
|
||||
onPressed: (selectedPolygonId == null)
|
||||
? null
|
||||
: _changePoints,
|
||||
child: const Text('修改坐标'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -171,7 +171,7 @@ class _State extends State<PolylineDemoPage> {
|
||||
List<LatLng> currentPoints = polyline.points;
|
||||
List<LatLng> newPoints = <LatLng>[];
|
||||
newPoints.addAll(currentPoints);
|
||||
newPoints.add(LatLng(39.835347, 116.34575));
|
||||
newPoints.add(const LatLng(39.835347, 116.34575));
|
||||
|
||||
setState(() {
|
||||
_polylines[selectedPolylineId!] = polyline.copyWith(
|
||||
@ -218,28 +218,28 @@ class _State extends State<PolylineDemoPage> {
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('添加'),
|
||||
onPressed: _add,
|
||||
child: const Text('添加'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('删除'),
|
||||
onPressed:
|
||||
(selectedPolylineId == null) ? null : _remove,
|
||||
child: const Text('删除'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改线宽'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeWidth,
|
||||
child: const Text('修改线宽'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改透明度'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeAlpha,
|
||||
child: const Text('修改透明度'),
|
||||
),
|
||||
AMapSwitchButton(
|
||||
label: Text('显示'),
|
||||
label: const Text('显示'),
|
||||
onSwitchChanged: (selectedPolylineId == null)
|
||||
? null
|
||||
: _toggleVisible,
|
||||
@ -250,34 +250,34 @@ class _State extends State<PolylineDemoPage> {
|
||||
Column(
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('修改颜色'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeColor,
|
||||
child: const Text('修改颜色'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改线头样式'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeCapType,
|
||||
child: const Text('修改线头样式'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改连接样式'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeJointType,
|
||||
child: const Text('修改连接样式'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改虚线类型'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changeDashLineType,
|
||||
child: const Text('修改虚线类型'),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('修改坐标'),
|
||||
onPressed: (selectedPolylineId == null)
|
||||
? null
|
||||
: _changePoints,
|
||||
child: const Text('修改坐标'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user