-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from enrique-lozano/feat/add-ukranian-lang
Add ukranian language
- Loading branch information
Showing
7 changed files
with
9,495 additions
and
3,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:monekin/app/settings/widgets/supported_locales.dart'; | ||
import 'package:monekin/core/presentation/widgets/modal_container.dart'; | ||
import 'package:monekin/i18n/translations.g.dart'; | ||
|
||
Future<String?> showLanguageSelectorBottomSheet( | ||
BuildContext context, LanguageSelector langSelector) { | ||
return showModalBottomSheet<String>( | ||
context: context, | ||
showDragHandle: true, | ||
isScrollControlled: true, | ||
builder: (context) { | ||
return langSelector; | ||
}, | ||
); | ||
} | ||
|
||
class LanguageSelector extends StatelessWidget { | ||
const LanguageSelector({super.key, required this.selectedLangTag}); | ||
|
||
/// Lang ID of the selected locale ("en", "zh-TW"...) | ||
final String selectedLangTag; | ||
|
||
Widget _langRadioTile(BuildContext context, | ||
{required SupportedLocale supportedLocale}) { | ||
return RadioListTile( | ||
value: supportedLocale.locale.languageTag, | ||
title: Text(supportedLocale.label), | ||
groupValue: selectedLangTag, | ||
onChanged: (value) { | ||
if (value == null) { | ||
return; | ||
} | ||
|
||
Navigator.of(context).pop(value); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final t = Translations.of(context); | ||
|
||
return ModalContainer( | ||
title: t.settings.lang_title, | ||
subtitle: t.settings.lang_descr, | ||
responseToKeyboard: false, | ||
body: SingleChildScrollView( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
...appSupportedLocales | ||
.map((e) => _langRadioTile(context, supportedLocale: e)), | ||
const SizedBox(height: 12) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:monekin/i18n/translations.g.dart'; | ||
|
||
class SupportedLocale { | ||
final AppLocale locale; | ||
final String label; | ||
|
||
const SupportedLocale({required this.locale, required this.label}); | ||
} | ||
|
||
const appSupportedLocales = [ | ||
SupportedLocale(locale: AppLocale.es, label: 'Español'), | ||
SupportedLocale(locale: AppLocale.en, label: 'English'), | ||
SupportedLocale(locale: AppLocale.uk, label: 'українська'), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.