mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
initialized Application theme
This commit is contained in:
25
lib/utils/helpers/localization_helpers.dart
Normal file
25
lib/utils/helpers/localization_helpers.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class LocalizationService {
|
||||
static saveLocale(Locale locale) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString("Locale Language Code", locale.languageCode);
|
||||
if (locale.countryCode != null) {
|
||||
await prefs.setString("Locale Country Code", locale.countryCode!);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Locale> savedLocale() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// var savedLanguageCode = prefs.getString(Constants.languageCode);
|
||||
// var savedCountryCode = prefs.getString(Constants.countryCode);
|
||||
var savedLocale = const Locale("ar", "JO");
|
||||
|
||||
// if (savedCountryCode != null && savedLanguageCode != null) {
|
||||
// savedLocale = Locale(savedLanguageCode, savedCountryCode);
|
||||
// }
|
||||
|
||||
return savedLocale;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user