Last changes not published
This commit is contained in:
parent
ac65ccf990
commit
21ec08303a
43 changed files with 607 additions and 613 deletions
|
|
@ -1,14 +1,12 @@
|
|||
import 'package:bson_objectid/bson_objectid.dart';
|
||||
import 'package:fires_flutter/objectIdUtils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:fires_flutter/objectIdUtils.dart';
|
||||
import 'package:objectid/objectid.dart';
|
||||
|
||||
part 'yourLocation.g.dart';
|
||||
|
||||
|
||||
|
||||
@JsonSerializable(nullable: false)
|
||||
class YourLocation extends Object with _$YourLocationSerializerMixin {
|
||||
class YourLocation {
|
||||
@JsonKey(toJson: objectIdToJson, fromJson: objectIdFromJson)
|
||||
ObjectId id;
|
||||
final double lat;
|
||||
|
|
@ -22,40 +20,33 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
_$YourLocationFromJson(json);
|
||||
|
||||
static YourLocation noLocation = new YourLocation(lat: 0.0, lon: 0.0);
|
||||
static const int withoutStats = null;
|
||||
static const int withoutStats = null;
|
||||
YourLocation(
|
||||
{this.id,
|
||||
@required this.lat,
|
||||
@required this.lon,
|
||||
this.description,
|
||||
this.distance: 10,
|
||||
int currentNumFires: withoutStats,
|
||||
int currentNumFires: withoutStats,
|
||||
this.subscribed: false}) {
|
||||
if (this.description == null)
|
||||
this.description = 'Position: ${this.lat}, ${this.lon}';
|
||||
if (this.id == null) this.id = new ObjectId();
|
||||
}
|
||||
Map<String, dynamic> toJson() => _$YourLocationToJson(this);
|
||||
|
||||
YourLocation copyWith(
|
||||
{id,
|
||||
lat,
|
||||
lon,
|
||||
description,
|
||||
distance,
|
||||
currentNumFires,
|
||||
subscribed}) {
|
||||
{id, lat, lon, description, distance, currentNumFires, subscribed}) {
|
||||
return new YourLocation(
|
||||
id: id?? this.id,
|
||||
lat: lat?? this.lat,
|
||||
lon: lon?? this.lon,
|
||||
description: description?? this.description,
|
||||
distance: distance?? this.distance,
|
||||
currentNumFires: currentNumFires ?? this.currentNumFires,
|
||||
subscribed: subscribed?? this.subscribed
|
||||
);
|
||||
id: id ?? this.id,
|
||||
lat: lat ?? this.lat,
|
||||
lon: lon ?? this.lon,
|
||||
description: description ?? this.description,
|
||||
distance: distance ?? this.distance,
|
||||
currentNumFires: currentNumFires ?? this.currentNumFires,
|
||||
subscribed: subscribed ?? this.subscribed);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
|
|
@ -66,7 +57,7 @@ static const int withoutStats = null;
|
|||
lon == other.lon &&
|
||||
description == other.description &&
|
||||
subscribed == other.subscribed &&
|
||||
currentNumFires == other.currentNumFires &&
|
||||
currentNumFires == other.currentNumFires &&
|
||||
distance == other.distance;
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue