Skip to content

Commit 671985b

Browse files
committed
feature: v0.1.3
1 parent cad8e55 commit 671985b

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
## 0.1.3
2+
3+
* Fixed refresh languages method.
4+
* Added `refreshWithLangWithContext(BuildContext, String)` method for language change.
5+
* Added `refreshWithLocaleWithContext(BuildContext, Locale)` method for language change.
6+
17
## 0.1.2
28

3-
* Added `refreshWithLang(String)` method language change.
4-
* Added `refreshWithLocale(Locale)` method language change.
9+
* Added `refreshWithLang(String)` method language for change.
10+
* Added `refreshWithLocale(Locale)` method language for change.
511

612
## 0.1.0
713

lib/stringcare.dart

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,37 @@ class Stringcare {
190190
return AppLocalizations.of(context)?.load() ?? Future.value(false);
191191
}
192192

193-
void refreshWithLang(String? lang) {
193+
Future<void> refreshWithLang(String? lang) async {
194194
withLang = () => lang;
195-
GlobalRefresh().refresh();
195+
if (await Stringcare().load()) {
196+
GlobalRefresh().refresh();
197+
}
198+
}
199+
200+
Future<void> refreshWithLocale(Locale? locale) async {
201+
withLocale = () => locale;
202+
if (await Stringcare().load()) {
203+
GlobalRefresh().refresh();
204+
}
196205
}
197206

198-
void refreshWithLocale(Locale? locale) {
207+
Future<void> refreshWithLangWithContext(
208+
BuildContext? context,
209+
String? lang,
210+
) async {
211+
withLang = () => lang;
212+
if (await Stringcare().loadWithContext(context)) {
213+
GlobalRefresh().refresh();
214+
}
215+
}
216+
217+
Future<void> refreshWithLocaleWithContext(
218+
BuildContext? context,
219+
Locale? locale,
220+
) async {
199221
withLocale = () => locale;
200-
GlobalRefresh().refresh();
222+
if (await Stringcare().loadWithContext(context)) {
223+
GlobalRefresh().refresh();
224+
}
201225
}
202226
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: stringcare
22
description: Flutter plugin for obfuscate and reveal strings and any other data.
3-
version: 0.1.2
3+
version: 0.1.3
44
homepage: https://github.com/StringCare/stringcare
55
repository: https://github.com/StringCare/stringcare
66

0 commit comments

Comments
 (0)