-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2120 from acterglobal/kumar/ui-ux-event-time
General fixes related to Time Format and Event Time UI
- Loading branch information
Showing
10 changed files
with
87 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- [New] : Time format is now based on the your localised system setting (12 Hour/24 Hour) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/lib/features/settings/providers/notifiers/locale_notifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:acter/features/settings/model/language_model.dart'; | ||
import 'package:acter_flutter_sdk/acter_flutter_sdk.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class LocaleNotifier extends StateNotifier<String> { | ||
LocaleNotifier() : super('en'); | ||
|
||
static const languagePrefKey = 'a3.language'; | ||
|
||
Future<void> initLanguage() async { | ||
final prefInstance = await sharedPrefs(); | ||
final prefLanguageCode = prefInstance.getString(languagePrefKey); | ||
final deviceLanguageCode = PlatformDispatcher.instance.locale.languageCode; | ||
final bool isLanguageContain = LanguageModel.allLanguagesList | ||
.where((element) => element.languageCode == deviceLanguageCode) | ||
.toList() | ||
.isNotEmpty; | ||
|
||
if (prefLanguageCode != null) { | ||
_localSet(prefLanguageCode); | ||
} else if (isLanguageContain) { | ||
_localSet(deviceLanguageCode); | ||
} | ||
} | ||
|
||
Future<void> setLanguage(String languageCode) async { | ||
final prefInstance = await sharedPrefs(); | ||
await prefInstance.setString(languagePrefKey, languageCode); | ||
_localSet(languageCode); | ||
} | ||
|
||
void _localSet(String languageCode) { | ||
state = languageCode; | ||
Intl.defaultLocale = languageCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters