chore: increase text size and spacing in language selection page, consume language locale emojis
This commit is contained in:
parent
ba4d05c8af
commit
a733224c50
2 changed files with 17 additions and 4 deletions
|
|
@ -10,12 +10,14 @@ class LanguageModel {
|
|||
final String langCode;
|
||||
final String displayName;
|
||||
final String script;
|
||||
final String? localeEmoji;
|
||||
final L2SupportEnum l2Support;
|
||||
final TextDirection? _textDirection;
|
||||
|
||||
LanguageModel({
|
||||
required this.langCode,
|
||||
required this.displayName,
|
||||
this.localeEmoji,
|
||||
this.script = LanguageKeys.unknownLanguage,
|
||||
this.l2Support = L2SupportEnum.na,
|
||||
TextDirection? textDirection,
|
||||
|
|
@ -40,6 +42,7 @@ class LanguageModel {
|
|||
(e) => e.name == json['text_direction'],
|
||||
)
|
||||
: null,
|
||||
localeEmoji: json['locale_emoji'],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -49,6 +52,7 @@ class LanguageModel {
|
|||
'script': script,
|
||||
'l2_support': l2Support.storageString,
|
||||
'text_direction': textDirection.name,
|
||||
'locale_emoji': localeEmoji,
|
||||
};
|
||||
|
||||
bool get l2 => l2Support != L2SupportEnum.na;
|
||||
|
|
@ -296,7 +300,13 @@ class LanguageModel {
|
|||
"zuDisplayName": l10n.zuDisplayName,
|
||||
};
|
||||
|
||||
return displayNameMap[langKey] ?? displayName;
|
||||
final display = displayNameMap[langKey] ?? displayName;
|
||||
if (langCode.contains('-') && localeEmoji != null) {
|
||||
// use regex to replace parentheses content with the locale emoji
|
||||
final regex = RegExp(r'\s*\(.*?\)\s*');
|
||||
return display.replaceFirst(regex, ' $localeEmoji ');
|
||||
}
|
||||
return display;
|
||||
}
|
||||
|
||||
String get langCodeShort => langCode.split('-').first;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ class LanguageSelectionPageState extends State<LanguageSelectionPage> {
|
|||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final languages = MatrixState.pangeaController.pLanguageStore.targetOptions;
|
||||
final isColumnMode = FluffyThemes.isColumnMode(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
@ -138,8 +139,8 @@ class LanguageSelectionPageState extends State<LanguageSelectionPage> {
|
|||
bottom: 60.0,
|
||||
),
|
||||
child: Wrap(
|
||||
spacing: 8.0,
|
||||
runSpacing: 8.0,
|
||||
spacing: isColumnMode ? 16.0 : 8.0,
|
||||
runSpacing: isColumnMode ? 16.0 : 8.0,
|
||||
alignment: WrapAlignment.center,
|
||||
children: languages
|
||||
.where(
|
||||
|
|
@ -164,7 +165,9 @@ class LanguageSelectionPageState extends State<LanguageSelectionPage> {
|
|||
),
|
||||
label: Text(
|
||||
l.getDisplayName(context),
|
||||
style: theme.textTheme.bodyMedium,
|
||||
style: isColumnMode
|
||||
? theme.textTheme.bodyLarge
|
||||
: theme.textTheme.bodyMedium,
|
||||
),
|
||||
onSelected: (selected) {
|
||||
_setSelectedLanguage(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue