Added fire notify and support page

This commit is contained in:
Vicente J. Ruiz Jurado 2018-07-24 15:11:00 +02:00
parent 6d9ad379c4
commit 5959670f80
7 changed files with 113 additions and 21 deletions

View file

@ -16,6 +16,7 @@ class FireAlert extends StatefulWidget {
class _FireAlertState extends State<FireAlert> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
int _currentStep = 0;
Widget buildCallButton() {
return new Align(
@ -54,25 +55,50 @@ class _FireAlertState extends State<FireAlert> {
);
}
List<Step> listWithoutNulls(List<Step> children) =>
children.where(notNull).toList();
@override
Widget build(BuildContext context) {
List fireSteps = listWithoutNulls(<Step>[
new Step(
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()
])),
// TODO conditional: this only in Spain
new Step(
title: new Text(S.of(context).tweetAboutAFireTitle),
// subtitle: new Text(S.of(context).tweetAboutAFireDescription),
content: new Column(children: <Widget>[
new Text(S.of(context).tweetAboutAFireDescription),
new SizedBox(height: 20.0),
buildTweetButton()
])),
]);
final stepInc = () {
setState(() {
if (_currentStep < fireSteps.length - 1) {
_currentStep += 1;
} else {
_currentStep = 0;
}
});
};
return Scaffold(
key: _scaffoldKey,
appBar: new AppBar(title: new Text(S.of(context).notifyAFire)),
body: new CenteredColumn(
children: <Widget>[
new Flexible(
child: new CenteredColumn(
children: <Widget>[
new Text(S.of(context).callEmergencyServicesDescription,
softWrap: true),
new Text(S.of(context).tweetAboutAFireDescription),
],
),
),
buildCallButton(),
buildTweetButton()
],
));
body: new Stepper(
currentStep: _currentStep,
// type: StepperType.horizontal,
onStepTapped: (num) => setState(() {
_currentStep = num;
}),
onStepContinue: stepInc,
onStepCancel: stepInc,
steps: fireSteps));
}
}

View file

@ -14,6 +14,7 @@ import 'sandbox.dart';
import 'theme.dart';
import 'privacyPage.dart';
import 'fireAlert.dart';
import 'supportPage.dart';
class FiresApp extends StatelessWidget {
static final WidgetBuilder introWidget = (context) => new IntroPage();
@ -25,7 +26,8 @@ class FiresApp extends StatelessWidget {
PrivacyPage.routeName: (BuildContext context) => new PrivacyPage(context),
ActiveFiresPage.routeName: (BuildContext context) => new ActiveFiresPage(),
Sandbox.routeName: (BuildContext context) => new Sandbox(),
FireAlert.routeName: (BuildContext context) => new FireAlert()
FireAlert.routeName: (BuildContext context) => new FireAlert(),
SupportPage.routeName: (BuildContext context) => new SupportPage(),
};
final Store<AppState> store;

View file

@ -38,6 +38,7 @@ class S implements WidgetsLocalizations {
String get anHour => "an hour";
String get appName => "All Against The Fire!";
String get callEmergencyServicesDescription => "You can call 112 if you have not already done so to notify the emergency services.";
String get callEmergencyServicesTitle => "Call 112";
String get chooseAPlace => "Choose a place";
String get chooseAWatchRadio => "Choose a watch radio";
String get confirm => "Confirm";
@ -50,10 +51,12 @@ class S implements WidgetsLocalizations {
String get notPermsUbication => "We don't have permission to get your location";
String get notifyAFire => "Notify a fire";
String get privacyPolicy => "Privacy Policy";
String get supportPageDescription => "You can support this initiative, spreading the word, helping us to develop our software, translating this app to your language, etc.";
String get supportThisInitiative => "Support this initiative";
String get toDeleteThisPlace => "Slide horizontally to delete this place";
String get toFiresNotifications => "Subscribe to fires notifications";
String get tweetAboutAFireDescription => "Additionally if you use twitter you can notify them with additional information, for example, attaching photos to the tweet if you have good visibility of the fire, when you took the photos, exact location, etc. Use #hashtags type #IFMinicipalTerminal for example #IFJumilla (Forest Fire in Jumilla).";
String get tweetAboutAFireDescription => "Additionally if you use twitter you can share additional information with the emergency services, for example, attaching photos to the tweet if you have good visibility of the fire, when you took the photos, exact location, etc. Use #hashtags type #IFMinicipalTerminal for example #IFJumilla (Forest Fire in Jumilla).";
String get tweetAboutAFireTitle => "Tweet about";
String get typeTheNameOfAPlace => "Type the name of a place, region, etc";
String get unsubscribe => "Unsubscribe";
String get warningThisIsAVeryLargeArea => "Warning: this is a very large area";
@ -98,7 +101,7 @@ class es extends S {
@override
String get toDeleteThisPlace => "Desliza horizontalmente para borrar este lugar";
@override
String get tweetAboutAFireDescription => "Adicionalmente si usas twitter puedes notificarles con información adicional, por ejemplo, adjuntando fotos al tweet si tienes buena visibilidad del fuego, cuando tomaste las fotos, ubicación exacta, etc. Usa #hashtags tipo #IFTerminoMunicipal por ejemplo #IFJumilla (Incendio Forestal en Jumilla).";
String get tweetAboutAFireDescription => "Adicionalmente si usas twitter puedes compartir información adicional con los servicios de emergencia, por ejemplo, adjuntando fotos al tweet si tienes buena visibilidad del fuego, cuando tomaste las fotos, ubicación exacta, etc. Usa #hashtags tipo #IFTerminoMunicipal por ejemplo #IFJumilla (Incendio Forestal en Jumilla).";
@override
String get AvoidThisStringsIfisNotPlural => "Zero One Two Few Many Other";
@override
@ -112,6 +115,8 @@ class es extends S {
@override
String get youDeletedThisPlace => "Has borrado este lugar";
@override
String get callEmergencyServicesTitle => "Llama al 112";
@override
String get chooseAPlace => "Elige un lugar";
@override
String get firesNearPlace => "Fuegos cercanos a ti";
@ -120,6 +125,10 @@ class es extends S {
@override
String get UNDO => "DESHACER";
@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, etc.";
@override
String get aMinute => "un minuto";
@override
String get firesInYourPlaces => "Fuegos en tus lugares";

View file

@ -8,6 +8,7 @@ import 'generated/i18n.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'privacyPage.dart';
import 'fireAlert.dart';
import 'supportPage.dart';
class MainDrawer extends Drawer {
MainDrawer(BuildContext context, {key})
@ -69,7 +70,7 @@ Widget mainDrawer(BuildContext context) {
onTap: () {
// Then close the drawer
Navigator.pop(context);
Navigator.pushNamed(context, '/subscriptions');
Navigator.pushNamed(context, SupportPage.routeName);
},
),
new ListTile(

48
lib/supportPage.dart Normal file
View file

@ -0,0 +1,48 @@
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'generated/i18n.dart';
class SupportPage extends StatefulWidget {
static const String routeName = '/support';
@override
_SupportPageState createState() => _SupportPageState();
}
class _SupportPageState extends State<SupportPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
Widget buildSupportButton() {
return new Align(
alignment: const Alignment(0.0, -0.2),
child: new FloatingActionButton(
heroTag: 'callAction',
child: const Icon(Icons.favorite),
onPressed: () {
launch("https://comunes.org/");
},
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar:
new AppBar(title: new Text(S.of(context).supportThisInitiative)),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: new CenteredColumn(children: <Widget>[
new Flexible(
child: new CenteredColumn(children: <Widget>[
new Text(S.of(context).supportPageDescription, textAlign: TextAlign.center,),
new SizedBox(height: 20.0),
buildSupportButton()
]))
]),
));
}
}

View file

@ -47,6 +47,9 @@
"CANCEL": "CANCEL",
"privacyPolicy": "Privacy Policy",
"errorFirePlaceDialog": "We couldn't get the location of the fire",
"callEmergencyServicesTitle": "Call 112",
"callEmergencyServicesDescription": "You can call 112 if you have not already done so to notify the emergency services.",
"tweetAboutAFireDescription": "Additionally if you use twitter you can notify them with additional information, for example, attaching photos to the tweet if you have good visibility of the fire, when you took the photos, exact location, etc. Use #hashtags type #IFMinicipalTerminal for example #IFJumilla (Forest Fire in Jumilla)."
"tweetAboutAFireTitle": "Tweet about",
"tweetAboutAFireDescription": "Additionally if you use twitter you can share additional information with the emergency services, for example, attaching photos to the tweet if you have good visibility of the fire, when you took the photos, exact location, etc. Use #hashtags type #IFMinicipalTerminal for example #IFJumilla (Forest Fire in Jumilla).",
"supportPageDescription": "You can support this initiative, spreading the word, helping us to develop our software, translating this app to your language, etc."
}

View file

@ -47,6 +47,9 @@
"CANCEL": "CANCELAR",
"privacyPolicy": "Política de Privacidad",
"errorFirePlaceDialog": "No hemos podido obtener la ubicación del fuego",
"callEmergencyServicesTitle": "Llama al 112",
"callEmergencyServicesDescription": "Puedes llamar al 112 si no lo has hecho ya para avisar a los servicios de emergencia.",
"tweetAboutAFireDescription": "Adicionalmente si usas twitter puedes notificarles con información adicional, por ejemplo, adjuntando fotos al tweet si tienes buena visibilidad del fuego, cuando tomaste las fotos, ubicación exacta, etc. Usa #hashtags tipo #IFTerminoMunicipal por ejemplo #IFJumilla (Incendio Forestal en Jumilla)."
"tweetAboutAFireTitle": "Twittea",
"tweetAboutAFireDescription": "Adicionalmente si usas twitter puedes compartir información adicional con los servicios de emergencia, por ejemplo, adjuntando fotos al tweet si tienes buena visibilidad del fuego, cuando tomaste las fotos, ubicación exacta, etc. Usa #hashtags tipo #IFTerminoMunicipal por ejemplo #IFJumilla (Incendio Forestal en Jumilla).",
"supportPageDescription": "Puedes apoyar esta iniciativa, dando difusión, ayudándonos a desarrollar nuestro software, traduciendo esta aplicación a tu idioma, etc."
}