More work with fire alerts

This commit is contained in:
Vicente J. Ruiz Jurado 2018-08-15 07:03:30 +02:00
parent 7b33b3fe70
commit 81a0d54a56
4 changed files with 47 additions and 4 deletions

View file

@ -33,6 +33,22 @@ class _FireAlertState extends State<FireAlert> {
);
}
Widget buildNotifyNeighboursButton() {
return new Align(
alignment: const Alignment(0.0, -0.2),
child: new FloatingActionButton(
heroTag: 'neighAction',
child: const Icon(CommunityMaterialIcons.bullhorn),
onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(S.of(context).inDevelopment),
));
},
),
);
}
Widget buildTweetButton() {
return new Align(
alignment: const Alignment(0.0, -0.2),
@ -46,7 +62,7 @@ class _FireAlertState extends State<FireAlert> {
String where =
yourLocation.description.replaceAll(' ', '').split(',')[0];
print(where);
Share.share('#IF${where} FIXME');
Share.share(S.of(context).tweetAboutSelf(yourLocation.description, '#IF${where}'));
}).catchError((onError) {
_scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
@ -65,12 +81,19 @@ class _FireAlertState extends State<FireAlert> {
List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
new CustomStep(
title: new Text(S.of(context).callEmergencyServicesTitle),
// subtitle:
content: new Column(children: <Widget>[
new Text(S.of(context).callEmergencyServicesDescription),
new SizedBox(height: 20.0),
buildCallButton()
])),
new CustomStep(
title: new Text(S.of(context).notifyNeighbours),
// state: CustomStepState.disabled,
content: new Column(children: <Widget>[
new Text(S.of(context).notifyNeighboursDescription),
new SizedBox(height: 20.0),
buildNotifyNeighboursButton()
])),
// TODO conditional: this only in Spain
new CustomStep(
title: new Text(S.of(context).tweetAboutAFireTitle),

View file

@ -59,6 +59,7 @@ class S implements WidgetsLocalizations {
String get firesInYourPlaces => "Active fires in your places";
String get firesNearPlace => "Fires near other place";
String get getAlertsOfFiresinThatArea => "Get alerts of fires in that area";
String get inDevelopment => "In development";
String get inGreenMonitoredAreas => "In green, the areas monitored by our users currently";
String get isYourUbicationEnabled => "I cannot get your current location. It's your ubication enabled?";
String get itSeemsAControlledBurning => "It's a controlled burning";
@ -72,6 +73,8 @@ class S implements WidgetsLocalizations {
String get notAWildfire => "Isn't that a forest fire?";
String get notPermsUbication => "We don't have permission to get your location";
String get notifyAFire => "Notify a fire";
String get notifyNeighbours => "Notify other users";
String get notifyNeighboursDescription => "Alert other users of the area about the fire";
String get privacyPolicy => "Privacy Policy";
String get shareAppBtn => "Share our app";
String get starAppBtn => "Rate our app";
@ -103,6 +106,7 @@ class S implements WidgetsLocalizations {
String noFiresAroundThisArea(String kmAround) => "There is no fires at $kmAround км around this area";
String somethingAgo(String something) => "$something ago";
String subscribeToValueAroundThisArea(String sliderValue) => "Subscribe to $sliderValue км around this area";
String tweetAboutSelf(String location, String hash) => "Fire in $location $hash";
String updatedLastCheck(String lastCheck) => "Updated $lastCheck";
}
@ -185,6 +189,10 @@ class es extends S {
@override
String get UNDO => "DESHACER";
@override
String get notifyNeighbours => "Notifica a otros usuarios/as";
@override
String get inDevelopment => "En desarrollo";
@override
String get tweetAboutAFireTitle => "Twittea";
@override
String get supportPageDescription => "Puedes apoyar esta iniciativa, dando difusión, ayudándonos a desarrollar nuestro software, traduciendo esta aplicación a tu idioma, sugeriendo otras fuentes de datos públicas de fuegos para usar, etc.";
@ -235,6 +243,8 @@ class es extends S {
@override
String get firesInTheWorld => "Fuegos en el mundo";
@override
String get notifyNeighboursDescription => "Alerta a otros usuarios de la zona sobre el fuego";
@override
String get addSomePlace => "Añade otro lugar";
@override
String get confirm => "Confirmar";
@ -267,6 +277,8 @@ class es extends S {
@override
String somethingAgo(String something) => "hace $something";
@override
String tweetAboutSelf(String location, String hash) => "Fuego en $location $hash";
@override
String subscribeToValueAroundThisArea(String sliderValue) => "Suscríbete a $sliderValue км a la redonda";
@override
String inHours(String value) => "$value horas";