feat: Enhance locale management by retrieving saved language code and updating language selection UI

This commit is contained in:
Achintha Isuru
2026-03-01 12:11:41 -05:00
parent 1e1dc39e20
commit b5001edf06
3 changed files with 8 additions and 5 deletions

View File

@@ -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();
}

View File

@@ -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>(

View File

@@ -20,7 +20,7 @@ class LanguageSelector extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: UiConstants.space3,
children: [
children: <Widget>[
const FieldLabel(text: 'Language'),
GestureDetector(