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
|
@override
|
||||||
Future<Locale> getSavedLocale() async {
|
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();
|
return getDefaultLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ class LanguageSelectionPage extends StatelessWidget {
|
|||||||
appBar: UiAppBar(
|
appBar: UiAppBar(
|
||||||
title: t.settings.change_language,
|
title: t.settings.change_language,
|
||||||
showBackButton: true,
|
showBackButton: true,
|
||||||
bottom: PreferredSize(
|
|
||||||
preferredSize: const Size.fromHeight(1.0),
|
|
||||||
child: Container(color: UiColors.border, height: 1.0),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: BlocBuilder<LocaleBloc, LocaleState>(
|
child: BlocBuilder<LocaleBloc, LocaleState>(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class LanguageSelector extends StatelessWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: UiConstants.space3,
|
spacing: UiConstants.space3,
|
||||||
children: [
|
children: <Widget>[
|
||||||
const FieldLabel(text: 'Language'),
|
const FieldLabel(text: 'Language'),
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
|||||||
Reference in New Issue
Block a user