Notrufnummern-Datenbasis, Ländererkennung, State-Management und Lokalisierung (AP1-AP7)
Implementiert den kompletten Kern-Flow der Emergency App gemäß docs/plan.md: - Notrufnummern-Datenbasis für 199 Länder + Modelle/Repository (AP1) - DialerService für tel:-Notrufe ohne Auto-Dial (AP2) - Statisches UI mit Panik-Button-Fallback (AP3) - Priorisierte Ländererkennung: SIM/Netz -> GPS/Geocoding -> Cache (AP4) - EmergencyProvider verdrahtet Repository/LocationService mit der UI (AP5) - Manuelle Länderauswahl als Fallback samt eigener Priorität (AP6) - UI-Lokalisierung (de/en/fr/es), an erkanntes Land gekoppelt (AP7) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,10 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations_de.dart';
|
||||
import 'app_localizations_en.dart';
|
||||
import 'app_localizations_es.dart';
|
||||
import 'app_localizations_fr.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -92,7 +95,72 @@ abstract class AppLocalizations {
|
||||
];
|
||||
|
||||
/// A list of this localizations delegate's supported locales.
|
||||
static const List<Locale> supportedLocales = <Locale>[Locale('en')];
|
||||
static const List<Locale> supportedLocales = <Locale>[
|
||||
Locale('de'),
|
||||
Locale('en'),
|
||||
Locale('es'),
|
||||
Locale('fr'),
|
||||
];
|
||||
|
||||
/// AppBar title of the home screen
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Emergency'**
|
||||
String get appTitle;
|
||||
|
||||
/// Label of the button/tooltip used to open the manual country picker
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Select country manually'**
|
||||
String get selectCountryButton;
|
||||
|
||||
/// Label of the button that retries country/number detection after an error
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Try again'**
|
||||
String get retryButton;
|
||||
|
||||
/// Fallback error message shown when the provider does not report a specific error
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Unknown error while loading the emergency numbers.'**
|
||||
String get errorGeneric;
|
||||
|
||||
/// Shown when the country could not be detected automatically (and no location permission info is shown separately)
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Country could not be determined.'**
|
||||
String get countryUnknownMessage;
|
||||
|
||||
/// Shown when the detected country has no entry in the emergency number database
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Country not listed in the emergency number database. Only the global emergency number is available.'**
|
||||
String get countryNotInDatabaseMessage;
|
||||
|
||||
/// AppBar title of the manual country picker screen
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Select country'**
|
||||
String get pickerTitle;
|
||||
|
||||
/// Hint text of the search field in the manual country picker screen
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Search country'**
|
||||
String get pickerSearchHint;
|
||||
|
||||
/// Empty state shown when the search filter matches no country
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No country found.'**
|
||||
String get pickerNoResults;
|
||||
|
||||
/// Semantics/tooltip label of an emergency button, combining the number's label and the number itself
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{label}, call {number}'**
|
||||
String emergencyButtonSemanticLabel(String label, String number);
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
@@ -106,7 +174,7 @@ class _AppLocalizationsDelegate
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) =>
|
||||
<String>['en'].contains(locale.languageCode);
|
||||
<String>['de', 'en', 'es', 'fr'].contains(locale.languageCode);
|
||||
|
||||
@override
|
||||
bool shouldReload(_AppLocalizationsDelegate old) => false;
|
||||
@@ -115,8 +183,14 @@ class _AppLocalizationsDelegate
|
||||
AppLocalizations lookupAppLocalizations(Locale locale) {
|
||||
// Lookup logic when only language code is specified.
|
||||
switch (locale.languageCode) {
|
||||
case 'de':
|
||||
return AppLocalizationsDe();
|
||||
case 'en':
|
||||
return AppLocalizationsEn();
|
||||
case 'es':
|
||||
return AppLocalizationsEs();
|
||||
case 'fr':
|
||||
return AppLocalizationsFr();
|
||||
}
|
||||
|
||||
throw FlutterError(
|
||||
|
||||
Reference in New Issue
Block a user