More work with fire stats
This commit is contained in:
parent
74b0d37839
commit
367df46f7e
6 changed files with 46 additions and 17 deletions
|
|
@ -82,9 +82,11 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRow(BuildContext context, YourLocation loc, onToggle, onTap) {
|
Widget _buildRow(BuildContext context, YourLocation loc, onToggle, onTap) {
|
||||||
|
final fireStatsStyle = new TextStyle(color: fires600);
|
||||||
return new ListTile(
|
return new ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: const Icon(Icons.location_on),
|
isThreeLine: false,
|
||||||
|
// leading: const Icon(Icons.location_on),
|
||||||
trailing: new IconButton(
|
trailing: new IconButton(
|
||||||
icon: new Icon(loc.subscribed
|
icon: new Icon(loc.subscribed
|
||||||
? Icons.notifications_active
|
? Icons.notifications_active
|
||||||
|
|
@ -93,12 +95,18 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
loc.subscribed = !loc.subscribed;
|
loc.subscribed = !loc.subscribed;
|
||||||
onToggle(loc);
|
onToggle(loc);
|
||||||
}),
|
}),
|
||||||
title:
|
title: new Text(loc.description),
|
||||||
new Text(loc.description)
|
subtitle: loc.currentNumFires == YourLocation.withoutStats
|
||||||
,
|
? null
|
||||||
subtitle: loc.currentNumFires == YourLocation.withoutStats ||
|
: loc.currentNumFires == 0
|
||||||
loc.currentNumFires == 0 ? null: new Text(S.of(context).firesAroundThisArea(
|
? new Text(S.of(context).noFiresAround)
|
||||||
loc.currentNumFires.toString(), loc.distance.toString())),
|
: loc.currentNumFires == 1
|
||||||
|
? new Text(S
|
||||||
|
.of(context)
|
||||||
|
.fireAroundThisArea(loc.distance.toString()), style: fireStatsStyle)
|
||||||
|
: new Text(S.of(context).firesAroundThisArea(
|
||||||
|
loc.currentNumFires.toString(),
|
||||||
|
loc.distance.toString()), style: fireStatsStyle),
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showSnackMsg(S.of(context).toDeleteThisPlace);
|
showSnackMsg(S.of(context).toDeleteThisPlace);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ class S implements WidgetsLocalizations {
|
||||||
String get firesNearPlace => "Fires near other place";
|
String get firesNearPlace => "Fires near other place";
|
||||||
String get getAlertsOfFiresinThatArea => "Get alerts of fires in that area";
|
String get getAlertsOfFiresinThatArea => "Get alerts of fires in that area";
|
||||||
String get isYourUbicationEnabled => "I cannot get your current location. It's your ubication enabled?";
|
String get isYourUbicationEnabled => "I cannot get your current location. It's your ubication enabled?";
|
||||||
|
String get noFiresAround => "There is no fires";
|
||||||
String get notPermsUbication => "We don't have permission to get your location";
|
String get notPermsUbication => "We don't have permission to get your location";
|
||||||
String get notifyAFire => "Notify a fire";
|
String get notifyAFire => "Notify a fire";
|
||||||
String get privacyPolicy => "Privacy Policy";
|
String get privacyPolicy => "Privacy Policy";
|
||||||
|
|
@ -73,6 +74,7 @@ class S implements WidgetsLocalizations {
|
||||||
String get youDeletedThisPlace => "You deleted this place";
|
String get youDeletedThisPlace => "You deleted this place";
|
||||||
String activeFiresWorldWide(String activeFires) => "$activeFires active fires worldwide";
|
String activeFiresWorldWide(String activeFires) => "$activeFires active fires worldwide";
|
||||||
String appLicense(String thisYear) => "(c) 2017-$thisYear Comunes Association under the GNU Affero GPL v3";
|
String appLicense(String thisYear) => "(c) 2017-$thisYear Comunes Association under the GNU Affero GPL v3";
|
||||||
|
String fireAroundThisArea(String kmAround) => "A fire at $kmAround км around this area";
|
||||||
String firesAroundThisArea(String numFires, String kmAround) => "$numFires fires at $kmAround км around this area";
|
String firesAroundThisArea(String numFires, String kmAround) => "$numFires fires at $kmAround км around this area";
|
||||||
String inDays(String value) => "$value days";
|
String inDays(String value) => "$value days";
|
||||||
String inHours(String value) => "$value hours";
|
String inHours(String value) => "$value hours";
|
||||||
|
|
@ -139,6 +141,8 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String get callEmergencyServicesTitle => "Llama al 112";
|
String get callEmergencyServicesTitle => "Llama al 112";
|
||||||
@override
|
@override
|
||||||
|
String get noFiresAround => "Sin fuegos";
|
||||||
|
@override
|
||||||
String get chooseAPlace => "Elige un lugar";
|
String get chooseAPlace => "Elige un lugar";
|
||||||
@override
|
@override
|
||||||
String get firesNearPlace => "Fuegos cercanos a ti";
|
String get firesNearPlace => "Fuegos cercanos a ti";
|
||||||
|
|
@ -219,6 +223,8 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String activeFiresWorldWide(String activeFires) => "$activeFires fuegos activos en el mundo";
|
String activeFiresWorldWide(String activeFires) => "$activeFires fuegos activos en el mundo";
|
||||||
@override
|
@override
|
||||||
|
String fireAroundThisArea(String kmAround) => "Un fuego a $kmAround км a la redonda";
|
||||||
|
@override
|
||||||
String inSomething(String something) => "en $something";
|
String inSomething(String something) => "en $something";
|
||||||
@override
|
@override
|
||||||
String inMinutes(String value) => "$value minutos";
|
String inMinutes(String value) => "$value minutos";
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class _ViewModel {
|
||||||
|
|
||||||
_ViewModel(
|
_ViewModel(
|
||||||
{@required this.mapState,
|
{@required this.mapState,
|
||||||
@required this.serverUrl,
|
@required this.serverUrl,
|
||||||
@required this.onSubs,
|
@required this.onSubs,
|
||||||
@required this.onSubsConfirmed,
|
@required this.onSubsConfirmed,
|
||||||
@required this.onUnSubs,
|
@required this.onUnSubs,
|
||||||
|
|
@ -107,7 +107,7 @@ class _genericMapState extends State<genericMap> {
|
||||||
store.dispatch(new UpdateYourLocationMapAction(loc));
|
store.dispatch(new UpdateYourLocationMapAction(loc));
|
||||||
store.dispatch(new EditConfirmYourLocationAction(loc));
|
store.dispatch(new EditConfirmYourLocationAction(loc));
|
||||||
},
|
},
|
||||||
serverUrl: store.state.firesApiUrl,
|
serverUrl: store.state.firesApiUrl,
|
||||||
mapState: store.state.fireMapState);
|
mapState: store.state.fireMapState);
|
||||||
},
|
},
|
||||||
builder: (context, view) {
|
builder: (context, view) {
|
||||||
|
|
@ -205,10 +205,16 @@ class _genericMapState extends State<genericMap> {
|
||||||
new TextEditingValue(
|
new TextEditingValue(
|
||||||
text: _location.description,
|
text: _location.description,
|
||||||
selection: new TextSelection.collapsed(
|
selection: new TextSelection.collapsed(
|
||||||
offset: _location.description.length - 1))),
|
offset: _location.description.length ))),
|
||||||
onChanged: (newDesc) {
|
onChanged: (newDesc) {
|
||||||
|
debugPrint("OnChanged");
|
||||||
_location = _location.copyWith(description: newDesc);
|
_location = _location.copyWith(description: newDesc);
|
||||||
},
|
},
|
||||||
|
onSubmitted: (newDesc) {
|
||||||
|
debugPrint("OnSubmitted");
|
||||||
|
_location = _location.copyWith(description: newDesc);
|
||||||
|
view.onEditConfirm(_location);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
: status == FireMapStatus.viewFireNotification
|
: status == FireMapStatus.viewFireNotification
|
||||||
? new Text(S.of(context).fireNotificationTitle)
|
? new Text(S.of(context).fireNotificationTitle)
|
||||||
|
|
@ -255,7 +261,8 @@ class _genericMapState extends State<genericMap> {
|
||||||
Stack(fit: StackFit.expand, children: <Widget>[
|
Stack(fit: StackFit.expand, children: <Widget>[
|
||||||
// Material(color: Colors.yellowAccent),
|
// Material(color: Colors.yellowAccent),
|
||||||
new Opacity(
|
new Opacity(
|
||||||
opacity: status == FireMapStatus.subscriptionConfirm
|
opacity: status == FireMapStatus.subscriptionConfirm ||
|
||||||
|
status == FireMapStatus.edit
|
||||||
? 0.5
|
? 0.5
|
||||||
: 1.0,
|
: 1.0,
|
||||||
child: map),
|
child: map),
|
||||||
|
|
@ -303,10 +310,12 @@ class _genericMapState extends State<genericMap> {
|
||||||
case FireMapStatus.viewFireNotification:
|
case FireMapStatus.viewFireNotification:
|
||||||
return <Widget>[
|
return <Widget>[
|
||||||
new IconButton(
|
new IconButton(
|
||||||
icon: new Icon(Icons.share),
|
icon: new Icon(Icons.share),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Share.share('${view.mapState.fireNotification.description}. ${view.serverUrl}fire/${view.mapState.fireNotification.sealed}');
|
Share.share(
|
||||||
})
|
'${view.mapState.fireNotification.description}. ${view
|
||||||
|
.serverUrl}fire/${view.mapState.fireNotification.sealed}');
|
||||||
|
})
|
||||||
];
|
];
|
||||||
default:
|
default:
|
||||||
return <Widget>[];
|
return <Widget>[];
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,10 @@ class GenericMapBottom extends StatelessWidget {
|
||||||
case FireMapStatus.view:
|
case FireMapStatus.view:
|
||||||
if (state.numFires != null) {
|
if (state.numFires != null) {
|
||||||
actionList.add(new Text(state.numFires > 0
|
actionList.add(new Text(state.numFires > 0
|
||||||
? S.of(context).firesAroundThisArea(
|
? loc.currentNumFires == 1
|
||||||
state.numFires.toString(), kmAround.toString())
|
? S.of(context).fireAroundThisArea(loc.distance.toString())
|
||||||
|
: S.of(context).firesAroundThisArea(
|
||||||
|
state.numFires.toString(), kmAround.toString())
|
||||||
: S.of(context).noFiresAroundThisArea(kmAround.toString())));
|
: S.of(context).noFiresAroundThisArea(kmAround.toString())));
|
||||||
// SizedBox(width: 10.0)
|
// SizedBox(width: 10.0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"unsubscribe": "Unsubscribe",
|
"unsubscribe": "Unsubscribe",
|
||||||
"firesAroundThisArea": "$numFires fires at $kmAround км around this area",
|
"firesAroundThisArea": "$numFires fires at $kmAround км around this area",
|
||||||
|
"fireAroundThisArea": "A fire at $kmAround км around this area",
|
||||||
"noFiresAroundThisArea": "There is no fires at $kmAround км around this area",
|
"noFiresAroundThisArea": "There is no fires at $kmAround км around this area",
|
||||||
|
"noFiresAround": "There is no fires",
|
||||||
"activeFiresWorldWide": "$activeFires active fires worldwide",
|
"activeFiresWorldWide": "$activeFires active fires worldwide",
|
||||||
"updatedLastCheck": "Updated $lastCheck",
|
"updatedLastCheck": "Updated $lastCheck",
|
||||||
"appLicense": "(c) 2017-$thisYear Comunes Association under the GNU Affero GPL v3",
|
"appLicense": "(c) 2017-$thisYear Comunes Association under the GNU Affero GPL v3",
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
"confirm": "Confirmar",
|
"confirm": "Confirmar",
|
||||||
"unsubscribe": "Desuscríbete",
|
"unsubscribe": "Desuscríbete",
|
||||||
"firesAroundThisArea": "$numFires fuegos a $kmAround км a la redonda",
|
"firesAroundThisArea": "$numFires fuegos a $kmAround км a la redonda",
|
||||||
|
"fireAroundThisArea": "Un fuego a $kmAround км a la redonda",
|
||||||
|
"noFiresAround": "Sin fuegos",
|
||||||
"noFiresAroundThisArea": "No hay fuegos a $kmAround км a la redonda",
|
"noFiresAroundThisArea": "No hay fuegos a $kmAround км a la redonda",
|
||||||
"activeFiresWorldWide": "$activeFires fuegos activos en el mundo",
|
"activeFiresWorldWide": "$activeFires fuegos activos en el mundo",
|
||||||
"updatedLastCheck": "Actualizado $lastCheck",
|
"updatedLastCheck": "Actualizado $lastCheck",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue