lint: code lint

This commit is contained in:
Kuloud 2024-08-26 00:00:23 +08:00
parent 8c59ec203a
commit 43ecfb8ca1
10 changed files with 39 additions and 31 deletions

View File

@ -11,11 +11,10 @@ class AMapGradView extends StatefulWidget {
final double? childAspectRatio;
AMapGradView(
{Key? key,
{super.key,
this.crossAxisCount,
this.childAspectRatio,
required this.childrenWidgets})
: super(key: key);
required this.childrenWidgets});
@override
_GradViewState createState() => _GradViewState();
}
@ -25,7 +24,7 @@ class _GradViewState extends State<AMapGradView> {
Widget build(BuildContext context) {
return GridView.count(
primary: false,
physics: new NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
//Widget之间间距
crossAxisSpacing: 1.0,
//Widget之间间距

View File

@ -7,12 +7,11 @@ class AMapRadioGroup<T> extends StatefulWidget {
final Map<String, T>? radioValueMap;
final ValueChanged<T?>? onChanged;
AMapRadioGroup(
{Key? key,
{super.key,
this.groupLabel,
this.groupValue,
this.radioValueMap,
this.onChanged})
: super(key: key);
this.onChanged});
@override
_AMapRadioGroupState<T> createState() => _AMapRadioGroupState<T>();
@ -31,7 +30,7 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
Widget build(BuildContext context) {
List<Widget> radioList = <Widget>[];
_groupValue = (widget.groupValue);
Widget _myRadio(String label, dynamic radioValue) {
Widget myRadio(String label, dynamic radioValue) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -39,11 +38,11 @@ class _AMapRadioGroupState<T> extends State<AMapRadioGroup<T>> {
Radio<T>(
value: radioValue,
groupValue: _groupValue,
onChanged: (T? _value) {
onChanged: (T? value) {
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) {
widget.radioValueMap!.forEach((key, value) {
radioList.add(_myRadio(key, value));
radioList.add(myRadio(key, value));
});
}
return Container(

View File

@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
typedef void OnChanged(bool value);
typedef OnChanged = void Function(bool value);
class AMapSwitchButton extends StatefulWidget {
const AMapSwitchButton({
Key? key,
super.key,
this.label,
this.onSwitchChanged,
this.defaultValue = true,
}) : super(key: key);
});
final Text? label;
final Function? onSwitchChanged;

View File

@ -10,7 +10,7 @@
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
part of amap_map;
part of '../amap_map.dart';
final MethodChannelAMapFlutterMap _methodChannel =
AMapFlutterPlatform.instance as MethodChannelAMapFlutterMap;
@ -30,7 +30,7 @@ class AMapController {
static Future<AMapController> init(
int id,
CameraPosition initialCameration,
_MapState mapState,
mapState,
) async {
await _methodChannel.init(id);
return AMapController._(

View File

@ -305,9 +305,9 @@ class _MapState extends State<AMapWidget> {
_markers = keyByMarkerId(widget.markers);
if (widget.infoWindowAdapter != null) {
_markers.values.forEach((marker) {
for (var marker in _markers.values) {
_onInfoWindowUpdate(marker);
});
}
}
}

View File

@ -23,6 +23,7 @@ import 'package:stream_transform/stream_transform.dart';
import 'map_event.dart';
// ignore: constant_identifier_names
const VIEW_TYPE = 'com.amap.flutter.map';
/// 使[MethodChannel]Native代码通信的[AMapFlutterPlatform]

View File

@ -234,9 +234,6 @@ class Marker extends BaseOverlay {
zIndex == typedOther.zIndex;
}
@override
int get hashCode => super.hashCode;
@override
String toString() {
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, '
'visible: $visible, zIndex: $zIndex, onTap: $onTap}';
}
@override
int get hashCode => Object.hashAll([
id,
]);
}
Map<String, Marker> keyByMarkerId(Iterable<Marker> markers) {

View File

@ -16,10 +16,10 @@ class MarkerUpdates {
return currentMarkers[id]!;
}
final Set<String> _markerIdsToRemove =
final Set<String> tempMarkerIdsToRemove =
prevMarkerIds.difference(currentMarkerIds);
final Set<Marker> _markersToAdd = currentMarkerIds
final Set<Marker> tempMarkersToAdd = currentMarkerIds
.difference(prevMarkerIds)
.map(idToCurrentMarker)
.toSet();
@ -29,15 +29,15 @@ class MarkerUpdates {
return current != previous;
}
final Set<Marker> _markersToChange = currentMarkerIds
final Set<Marker> tempMarkersToChange = currentMarkerIds
.intersection(prevMarkerIds)
.map(idToCurrentMarker)
.where(hasChanged)
.toSet();
markersToAdd = _markersToAdd;
markerIdsToRemove = _markerIdsToRemove;
markersToChange = _markersToChange;
markersToAdd = tempMarkersToAdd;
markerIdsToRemove = tempMarkerIdsToRemove;
markersToChange = tempMarkersToChange;
}
/// marker集合.

View File

@ -18,8 +18,8 @@ class Polygon extends BaseOverlay {
this.fillColor = const Color(0xC487CEFA),
this.visible = true,
this.joinType = JoinType.bevel})
: assert(points.length > 0),
this.strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
: assert(points.isNotEmpty),
strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
super();
/// ,
@ -100,7 +100,9 @@ class Polygon extends BaseOverlay {
}
@override
int get hashCode => super.hashCode;
int get hashCode => Object.hashAll([
id,
]);
dynamic _pointsToJson() {
final List<dynamic> result = <dynamic>[];

View File

@ -184,6 +184,11 @@ class Polyline extends BaseOverlay {
}
return result;
}
@override
int get hashCode => Object.hashAll([
id,
]);
}
Map<String, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {