More fire stats
This commit is contained in:
parent
9dd8a7de97
commit
74b0d37839
6 changed files with 54 additions and 9 deletions
|
|
@ -3,6 +3,8 @@ import 'package:fires_flutter/models/fireNotification.dart';
|
|||
import 'package:fires_flutter/models/yourLocation.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'fireMapState.dart';
|
||||
import 'user.dart';
|
||||
|
|
@ -95,6 +97,7 @@ class AppState extends Object with _$AppStateSerializerMixin {
|
|||
|
||||
typedef void AddYourLocationFunction(YourLocation loc);
|
||||
typedef void DeleteYourLocationFunction(YourLocation loc);
|
||||
typedef void OnRefreshYourLocationsFunction(Completer<Null> callback);
|
||||
typedef void ToggleSubscriptionFunction(YourLocation loc);
|
||||
typedef void OnLocationTapFunction(YourLocation loc);
|
||||
typedef void OnSubscribeFunction(YourLocation loc);
|
||||
|
|
|
|||
|
|
@ -16,18 +16,20 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
String description;
|
||||
bool subscribed;
|
||||
int distance;
|
||||
int currentNumFires;
|
||||
|
||||
factory YourLocation.fromJson(Map<String, dynamic> json) =>
|
||||
_$YourLocationFromJson(json);
|
||||
|
||||
static YourLocation noLocation = new YourLocation(lat: 0.0, lon: 0.0);
|
||||
|
||||
static const int withoutStats = null;
|
||||
YourLocation(
|
||||
{this.id,
|
||||
@required this.lat,
|
||||
@required this.lon,
|
||||
this.description,
|
||||
this.distance: 10,
|
||||
int currentNumFires: withoutStats,
|
||||
this.subscribed: false}) {
|
||||
if (this.description == null)
|
||||
this.description = 'Position: ${this.lat}, ${this.lon}';
|
||||
|
|
@ -40,6 +42,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon,
|
||||
description,
|
||||
distance,
|
||||
currentNumFires,
|
||||
subscribed}) {
|
||||
return new YourLocation(
|
||||
id: id?? this.id,
|
||||
|
|
@ -47,6 +50,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon: lon?? this.lon,
|
||||
description: description?? this.description,
|
||||
distance: distance?? this.distance,
|
||||
currentNumFires: currentNumFires ?? this.currentNumFires,
|
||||
subscribed: subscribed?? this.subscribed
|
||||
);
|
||||
}
|
||||
|
|
@ -62,6 +66,7 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon == other.lon &&
|
||||
description == other.description &&
|
||||
subscribed == other.subscribed &&
|
||||
currentNumFires == other.currentNumFires &&
|
||||
distance == other.distance;
|
||||
|
||||
@override
|
||||
|
|
@ -71,10 +76,11 @@ class YourLocation extends Object with _$YourLocationSerializerMixin {
|
|||
lon.hashCode ^
|
||||
description.hashCode ^
|
||||
subscribed.hashCode ^
|
||||
currentNumFires.hashCode ^
|
||||
distance.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'YourLocation {id: $id, lat: $lat, lon: $lon, description: $description, subscribed: $subscribed, distance: $distance}';
|
||||
return 'YourLocation {id: $id, lat: $lat, lon: $lon, description: $description, subscribed: $subscribed, distance: $distance, currentNumFires: $currentNumFires}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue