feat: Enhance locale management by retrieving saved language code and updating language selection UI
This commit is contained in:
@@ -21,6 +21,13 @@ class LocaleRepositoryImpl implements LocaleRepositoryInterface {
|
||||
|
||||
@override
|
||||
Future<Locale> getSavedLocale() async {
|
||||
final String? savedLanguageCode = await localDataSource.getLanguageCode();
|
||||
if (savedLanguageCode != null) {
|
||||
final Locale savedLocale = Locale(savedLanguageCode);
|
||||
if (getSupportedLocales().contains(savedLocale)) {
|
||||
return savedLocale;
|
||||
}
|
||||
}
|
||||
return getDefaultLocale();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@ class LanguageSelectionPage extends StatelessWidget {
|
||||
appBar: UiAppBar(
|
||||
title: t.settings.change_language,
|
||||
showBackButton: true,
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(1.0),
|
||||
child: Container(color: UiColors.border, height: 1.0),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: BlocBuilder<LocaleBloc, LocaleState>(
|
||||
|
||||
@@ -20,7 +20,7 @@ class LanguageSelector extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: UiConstants.space3,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const FieldLabel(text: 'Language'),
|
||||
|
||||
GestureDetector(
|
||||
|
||||
Reference in New Issue
Block a user