UI for settings.translations

This commit is contained in:
Hillel Coren 2020-08-09 15:14:00 +03:00
parent 83f0087fae
commit eb21a99cc8
2 changed files with 20 additions and 4 deletions

View File

@ -235,7 +235,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
value: key,
))
.toList(),
hint: Text(localization.selectField),
hint: Text(localization.selectLabel),
onChanged: (value) {
viewModel.onSettingsChanged(settings
.rebuild((b) => b..translations[value] = ''));
@ -243,7 +243,23 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
),
),
SizedBox(height: 16),
for (var key in settings.translations.keys) Text(key),
for (var key in settings.translations.keys)
Row(
children: [
Expanded(child: Text(localization.lookup(key))),
Expanded(
child: TextFormField(),
),
SizedBox(width: 16),
IconButton(
icon: Icon(Icons.clear),
onPressed: () {
viewModel.onSettingsChanged(settings
.rebuild((b) => b..translations.remove(key)));
},
)
],
)
],
),
],

View File

@ -15,7 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'select_field': 'Select Field',
'select_label': 'Select Label',
'custom_labels': 'Custom Labels',
'record_type': 'Record Type',
'record_name': 'Record Name',
@ -39023,7 +39023,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get customLabels => _localizedValues[localeCode]['custom_labels'] ?? '';
String get selectField => _localizedValues[localeCode]['select_field'] ?? '';
String get selectLabel => _localizedValues[localeCode]['select_label'] ?? '';
String lookup(String key) {
final lookupKey = toSnakeCase(key);