lint: code lint
This commit is contained in:
parent
8c59ec203a
commit
43ecfb8ca1
|
@ -11,11 +11,10 @@ class AMapGradView extends StatefulWidget {
|
||||||
final double? childAspectRatio;
|
final double? childAspectRatio;
|
||||||
|
|
||||||
AMapGradView(
|
AMapGradView(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.crossAxisCount,
|
this.crossAxisCount,
|
||||||
this.childAspectRatio,
|
this.childAspectRatio,
|
||||||
required this.childrenWidgets})
|
required this.childrenWidgets});
|
||||||
: super(key: key);
|
|
||||||
@override
|
@override
|
||||||
_GradViewState createState() => _GradViewState();
|
_GradViewState createState() => _GradViewState();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +24,7 @@ class _GradViewState extends State<AMapGradView> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
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之间间距
|
||||||
|
|
|
@ -7,12 +7,11 @@ class AMapRadioGroup<T> extends StatefulWidget {
|
||||||
final Map<String, T>? radioValueMap;
|
final Map<String, T>? radioValueMap;
|
||||||
final ValueChanged<T?>? onChanged;
|
final ValueChanged<T?>? onChanged;
|
||||||
AMapRadioGroup(
|
AMapRadioGroup(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.groupLabel,
|
this.groupLabel,
|
||||||
this.groupValue,
|
this.groupValue,
|
||||||
this.radioValueMap,
|
this.radioValueMap,
|
||||||
this.onChanged})
|
this.onChanged});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_AMapRadioGroupState<T> createState() => _AMapRadioGroupState<T>();
|
_AMapRadioGroupState<T> createState() => _AMapRadioGroupState<T>();
|
||||||
|
@ -31,7 +30,7 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<Widget> radioList = <Widget>[];
|
List<Widget> radioList = <Widget>[];
|
||||||
_groupValue = (widget.groupValue);
|
_groupValue = (widget.groupValue);
|
||||||
Widget _myRadio(String label, dynamic radioValue) {
|
Widget myRadio(String label, dynamic radioValue) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -39,11 +38,11 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
|
||||||
Radio<T>(
|
Radio<T>(
|
||||||
value: radioValue,
|
value: radioValue,
|
||||||
groupValue: _groupValue,
|
groupValue: _groupValue,
|
||||||
onChanged: (T? _value) {
|
onChanged: (T? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_groupValue = _value;
|
_groupValue = value;
|
||||||
});
|
});
|
||||||
widget.onChanged!(_value);
|
widget.onChanged!(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -52,7 +51,7 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
|
||||||
|
|
||||||
if (widget.radioValueMap != null) {
|
if (widget.radioValueMap != null) {
|
||||||
widget.radioValueMap!.forEach((key, value) {
|
widget.radioValueMap!.forEach((key, value) {
|
||||||
radioList.add(_myRadio(key, value));
|
radioList.add(myRadio(key, value));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Container(
|
return Container(
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
typedef void OnChanged(bool value);
|
typedef OnChanged = void Function(bool value);
|
||||||
|
|
||||||
class AMapSwitchButton extends StatefulWidget {
|
class AMapSwitchButton extends StatefulWidget {
|
||||||
const AMapSwitchButton({
|
const AMapSwitchButton({
|
||||||
Key? key,
|
super.key,
|
||||||
this.label,
|
this.label,
|
||||||
this.onSwitchChanged,
|
this.onSwitchChanged,
|
||||||
this.defaultValue = true,
|
this.defaultValue = true,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final Text? label;
|
final Text? label;
|
||||||
final Function? onSwitchChanged;
|
final Function? onSwitchChanged;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
|
||||||
part of amap_map;
|
part of '../amap_map.dart';
|
||||||
|
|
||||||
final MethodChannelAMapFlutterMap _methodChannel =
|
final MethodChannelAMapFlutterMap _methodChannel =
|
||||||
AMapFlutterPlatform.instance as MethodChannelAMapFlutterMap;
|
AMapFlutterPlatform.instance as MethodChannelAMapFlutterMap;
|
||||||
|
@ -30,7 +30,7 @@ class AMapController {
|
||||||
static Future<AMapController> init(
|
static Future<AMapController> init(
|
||||||
int id,
|
int id,
|
||||||
CameraPosition initialCameration,
|
CameraPosition initialCameration,
|
||||||
_MapState mapState,
|
mapState,
|
||||||
) async {
|
) async {
|
||||||
await _methodChannel.init(id);
|
await _methodChannel.init(id);
|
||||||
return AMapController._(
|
return AMapController._(
|
||||||
|
|
|
@ -305,9 +305,9 @@ class _MapState extends State<AMapWidget> {
|
||||||
_markers = keyByMarkerId(widget.markers);
|
_markers = keyByMarkerId(widget.markers);
|
||||||
|
|
||||||
if (widget.infoWindowAdapter != null) {
|
if (widget.infoWindowAdapter != null) {
|
||||||
_markers.values.forEach((marker) {
|
for (var marker in _markers.values) {
|
||||||
_onInfoWindowUpdate(marker);
|
_onInfoWindowUpdate(marker);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import 'package:stream_transform/stream_transform.dart';
|
||||||
|
|
||||||
import 'map_event.dart';
|
import 'map_event.dart';
|
||||||
|
|
||||||
|
// ignore: constant_identifier_names
|
||||||
const VIEW_TYPE = 'com.amap.flutter.map';
|
const VIEW_TYPE = 'com.amap.flutter.map';
|
||||||
|
|
||||||
/// 使用[MethodChannel]与Native代码通信的[AMapFlutterPlatform]的实现。
|
/// 使用[MethodChannel]与Native代码通信的[AMapFlutterPlatform]的实现。
|
||||||
|
|
|
@ -234,9 +234,6 @@ class Marker extends BaseOverlay {
|
||||||
zIndex == typedOther.zIndex;
|
zIndex == typedOther.zIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => super.hashCode;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Marker{id: $id, alpha: $alpha, anchor: $anchor, '
|
return 'Marker{id: $id, alpha: $alpha, anchor: $anchor, '
|
||||||
|
@ -244,6 +241,11 @@ class Marker extends BaseOverlay {
|
||||||
'icon: $icon, infoWindowEnable: $infoWindowEnable, infoWindow: $infoWindow, position: $position, rotation: $rotation, '
|
'icon: $icon, infoWindowEnable: $infoWindowEnable, infoWindow: $infoWindow, position: $position, rotation: $rotation, '
|
||||||
'visible: $visible, zIndex: $zIndex, onTap: $onTap}';
|
'visible: $visible, zIndex: $zIndex, onTap: $onTap}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hashAll([
|
||||||
|
id,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Marker> keyByMarkerId(Iterable<Marker> markers) {
|
Map<String, Marker> keyByMarkerId(Iterable<Marker> markers) {
|
||||||
|
|
|
@ -16,10 +16,10 @@ class MarkerUpdates {
|
||||||
return currentMarkers[id]!;
|
return currentMarkers[id]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> _markerIdsToRemove =
|
final Set<String> tempMarkerIdsToRemove =
|
||||||
prevMarkerIds.difference(currentMarkerIds);
|
prevMarkerIds.difference(currentMarkerIds);
|
||||||
|
|
||||||
final Set<Marker> _markersToAdd = currentMarkerIds
|
final Set<Marker> tempMarkersToAdd = currentMarkerIds
|
||||||
.difference(prevMarkerIds)
|
.difference(prevMarkerIds)
|
||||||
.map(idToCurrentMarker)
|
.map(idToCurrentMarker)
|
||||||
.toSet();
|
.toSet();
|
||||||
|
@ -29,15 +29,15 @@ class MarkerUpdates {
|
||||||
return current != previous;
|
return current != previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<Marker> _markersToChange = currentMarkerIds
|
final Set<Marker> tempMarkersToChange = currentMarkerIds
|
||||||
.intersection(prevMarkerIds)
|
.intersection(prevMarkerIds)
|
||||||
.map(idToCurrentMarker)
|
.map(idToCurrentMarker)
|
||||||
.where(hasChanged)
|
.where(hasChanged)
|
||||||
.toSet();
|
.toSet();
|
||||||
|
|
||||||
markersToAdd = _markersToAdd;
|
markersToAdd = tempMarkersToAdd;
|
||||||
markerIdsToRemove = _markerIdsToRemove;
|
markerIdsToRemove = tempMarkerIdsToRemove;
|
||||||
markersToChange = _markersToChange;
|
markersToChange = tempMarkersToChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 想要添加的marker集合.
|
/// 想要添加的marker集合.
|
||||||
|
|
|
@ -18,8 +18,8 @@ class Polygon extends BaseOverlay {
|
||||||
this.fillColor = const Color(0xC487CEFA),
|
this.fillColor = const Color(0xC487CEFA),
|
||||||
this.visible = true,
|
this.visible = true,
|
||||||
this.joinType = JoinType.bevel})
|
this.joinType = JoinType.bevel})
|
||||||
: assert(points.length > 0),
|
: assert(points.isNotEmpty),
|
||||||
this.strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
|
strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
|
||||||
super();
|
super();
|
||||||
|
|
||||||
/// 覆盖物的坐标点数组,不能为空
|
/// 覆盖物的坐标点数组,不能为空
|
||||||
|
@ -100,7 +100,9 @@ class Polygon extends BaseOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => super.hashCode;
|
int get hashCode => Object.hashAll([
|
||||||
|
id,
|
||||||
|
]);
|
||||||
|
|
||||||
dynamic _pointsToJson() {
|
dynamic _pointsToJson() {
|
||||||
final List<dynamic> result = <dynamic>[];
|
final List<dynamic> result = <dynamic>[];
|
||||||
|
|
|
@ -184,6 +184,11 @@ class Polyline extends BaseOverlay {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hashAll([
|
||||||
|
id,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {
|
Map<String, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {
|
||||||
|
|
Loading…
Reference in New Issue