aves/lib/widgets/common/map/geo_entry.dart
Thibault Deckers 7747e19f73 #3 map page
2021-08-06 15:23:53 +09:00

41 lines
1.2 KiB
Dart

import 'package:aves/model/entry.dart';
import 'package:fluster/fluster.dart';
import 'package:flutter/foundation.dart';
class GeoEntry extends Clusterable {
AvesEntry? entry;
GeoEntry({
this.entry,
double? latitude,
double? longitude,
bool? isCluster = false,
int? clusterId,
int? pointsSize,
String? markerId,
String? childMarkerId,
}) : super(
latitude: latitude,
longitude: longitude,
isCluster: isCluster,
clusterId: clusterId,
pointsSize: pointsSize,
markerId: markerId,
childMarkerId: childMarkerId,
);
factory GeoEntry.createCluster(BaseCluster cluster, double longitude, double latitude) {
return GeoEntry(
latitude: latitude,
longitude: longitude,
isCluster: cluster.isCluster,
clusterId: cluster.id,
pointsSize: cluster.pointsSize,
markerId: cluster.id.toString(),
childMarkerId: cluster.childMarkerId,
);
}
@override
String toString() => '$runtimeType#${shortHash(this)}{isCluster=$isCluster, lat=$latitude, lng=$longitude, clusterId=$clusterId, pointsSize=$pointsSize, markerId=$markerId, childMarkerId=$childMarkerId}';
}