mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-06 09:15:48 -06:00
Externalized API and models as own package
This commit is contained in:
@@ -14,13 +14,18 @@ class LanguageSelectionSetting extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LanguageSelectionSettingState extends State<LanguageSelectionSetting> {
|
||||
static const _languageOptions = {
|
||||
'en': 'English',
|
||||
'de': 'Deutsch',
|
||||
'cs': 'Česky',
|
||||
};
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<ApplicationSettingsCubit, ApplicationSettingsState>(
|
||||
builder: (context, settings) {
|
||||
return ListTile(
|
||||
title: Text(S.of(context).settingsPageLanguageSettingLabel),
|
||||
subtitle: Text(_mapSubtagToLanguage(settings.preferredLocaleSubtag)),
|
||||
subtitle: Text(_languageOptions[settings.preferredLocaleSubtag]!),
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (_) => RadioSettingsDialog<String>(
|
||||
@@ -28,12 +33,16 @@ class _LanguageSelectionSettingState extends State<LanguageSelectionSetting> {
|
||||
options: [
|
||||
RadioOption(
|
||||
value: 'en',
|
||||
label: _mapSubtagToLanguage('en'),
|
||||
label: _languageOptions['en']!,
|
||||
),
|
||||
RadioOption(
|
||||
value: 'de',
|
||||
label: _mapSubtagToLanguage('de'),
|
||||
label: _languageOptions['de']!,
|
||||
),
|
||||
RadioOption(
|
||||
value: 'cs',
|
||||
label: _languageOptions['cs']!,
|
||||
)
|
||||
],
|
||||
initialValue: BlocProvider.of<ApplicationSettingsCubit>(context)
|
||||
.state
|
||||
@@ -45,15 +54,4 @@ class _LanguageSelectionSettingState extends State<LanguageSelectionSetting> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_mapSubtagToLanguage(String subtag) {
|
||||
switch (subtag) {
|
||||
case 'en':
|
||||
return "English";
|
||||
case 'de':
|
||||
return "Deutsch";
|
||||
default:
|
||||
return "English";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user