diff --git a/lib/fireNotificationList.dart b/lib/fireNotificationList.dart index c8a5124..385ae72 100644 --- a/lib/fireNotificationList.dart +++ b/lib/fireNotificationList.dart @@ -159,7 +159,8 @@ class _FireNotificationListState extends State { hasFireNotifications ? IconButton( icon: Icon(Icons.delete), - onPressed: () => view.onDeleteAll(), + onPressed: () => + _showConfirmDialog(view) ) : null ])), @@ -178,7 +179,7 @@ class _FireNotificationListState extends State { textAlign: TextAlign.center, textScaleFactor: 1.1, style: new TextStyle( - height: 1.5, color: Colors.black45)) + height: 1.3, color: Colors.black45)) ])))) : _buildSavedFireNotifications(context, view.fireNotifications, view.onDelete, view.onTap)); @@ -191,4 +192,34 @@ class _FireNotificationListState extends State { Navigator.push(context, new MaterialPageRoute(builder: (context) => new FireNotificationMap())); */ } + + _showConfirmDialog(_ViewModel view) { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return new AlertDialog( + title: new Text(S.of(context).areYouSureTitle), + content: new SingleChildScrollView( + child: new ListBody( + children: [ + new Text(S.of(context).deleteAllFireNotificationsAlertDescription + ) + ], + ), + ), + actions: [ + new FlatButton( + child: new Text(S.of(context).DELETE), + onPressed: () { + view.onDeleteAll(); + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } } + diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 8218326..7a49965 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -23,6 +23,7 @@ class S implements WidgetsLocalizations { String get AvoidThisStringsIfisNotPlural => "Zero One Two Few Many Other"; String get CANCEL => "CANCEL"; + String get DELETE => "DELETE"; String get SAVE => "SAVE"; String get UNDO => "UNDO"; String get aDay => "a day"; @@ -37,11 +38,13 @@ class S implements WidgetsLocalizations { String get alertWhenThereIsAFire => "Alert when there is a fire"; String get anHour => "an hour"; String get appName => "All Against The Fire!"; + String get areYouSureTitle => "Are you sure?"; 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"; + String get deleteAllFireNotificationsAlertDescription => "This will remove all your fire notifications"; String get errorFirePlaceDialog => "We couldn't get the location of the fire"; String get fireNotificationsDescription => "Here you will receive fire notifications in locations you are subscribed to"; String get fireNotificationsTitle => "Fire Notifications"; @@ -97,6 +100,8 @@ class es extends S { @override String get anHour => "una hora"; @override + String get areYouSureTitle => "¿Seguro?"; + @override String get notifyAFire => "Notificar un fuego"; @override String get callEmergencyServicesDescription => "Puedes llamar al 112 si no lo has hecho ya para avisar a los servicios de emergencia."; @@ -105,6 +110,8 @@ class es extends S { @override String get toDeleteThisPlace => "Desliza horizontalmente para borrar este lugar"; @override + String get deleteAllFireNotificationsAlertDescription => "Esto borrará todas las notificaciones de fuegos"; + @override 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"; @@ -141,6 +148,8 @@ class es extends S { @override String get isYourUbicationEnabled => "No podemos saber tu ubicación actual. ¿Están los servicios de ubicación en tu móvil activados?"; @override + String get DELETE => "BORRAR"; + @override String get aDay => "un día"; @override String get SAVE => "GUARDAR"; diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 23aa8e6..4356773 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -53,5 +53,8 @@ "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.", "fireNotificationsTitle": "Fire Notifications", - "fireNotificationsDescription": "Here you will receive fire notifications in locations you are subscribed to" + "fireNotificationsDescription": "Here you will receive fire notifications in locations you are subscribed to", + "areYouSureTitle": "Are you sure?", + "deleteAllFireNotificationsAlertDescription": "This will remove all your fire notifications", + "DELETE": "DELETE" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 6d29ba9..a577572 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -53,5 +53,8 @@ "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.", "fireNotificationsTitle": "Notificaciones de fuegos", - "fireNotificationsDescription": "Aquí recibirás las notificaciones de fuegos en los lugares a los que te subscribas" + "fireNotificationsDescription": "Aquí recibirás las notificaciones de fuegos en los lugares a los que te subscribas", + "areYouSureTitle": "¿Seguro?", + "deleteAllFireNotificationsAlertDescription": "Esto borrará todas las notificaciones de fuegos", + "DELETE": "BORRAR" } \ No newline at end of file