Skip to content

Commit cad8e55

Browse files
committed
feature: v0.1.2
1 parent 026c3c6 commit cad8e55

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.1.2
2+
3+
* Added `refreshWithLang(String)` method language change.
4+
* Added `refreshWithLocale(Locale)` method language change.
5+
16
## 0.1.0
27

38
* Added `string()` method for getting resources.

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MyAppPage extends StatefulWidget {
5050
MyAppPageState createState() => MyAppPageState();
5151
}
5252

53-
class MyAppPageState extends State<MyAppPage> {
53+
class MyAppPageState extends ScState<MyAppPage> {
5454
String _platformVersion = 'Unknown';
5555
String asyncValue = "";
5656

lib/src/widget/sc_state.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import 'package:flutter/widgets.dart';
2+
import 'package:global_refresh/global_refresh.dart';
3+
4+
abstract class ScState<T extends StatefulWidget> extends GRState<T> {}

lib/stringcare.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/services.dart';
33
import 'package:flutter_localizations/flutter_localizations.dart';
4+
import 'package:global_refresh/global_refresh.dart';
45
import 'package:go_router/go_router.dart';
56
import 'package:stringcare/src/web/stringcare_impl.dart'
67
if (dart.library.io) 'package:stringcare/src/native/stringcare_impl.dart';
@@ -14,6 +15,7 @@ export 'src/i18n/remote_languages.dart';
1415
export 'src/widget/sc_asset_image_provider.dart';
1516
export 'src/widget/sc_image_asset.dart';
1617
export 'src/widget/sc_svg.dart';
18+
export 'src/widget/sc_state.dart';
1719

1820
class Stringcare {
1921
static Stringcare? _instance;
@@ -187,4 +189,14 @@ class Stringcare {
187189
if (context == null) return false;
188190
return AppLocalizations.of(context)?.load() ?? Future.value(false);
189191
}
192+
193+
void refreshWithLang(String? lang) {
194+
withLang = () => lang;
195+
GlobalRefresh().refresh();
196+
}
197+
198+
void refreshWithLocale(Locale? locale) {
199+
withLocale = () => locale;
200+
GlobalRefresh().refresh();
201+
}
190202
}

pubspec.yaml

Lines changed: 2 additions & 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.1
3+
version: 0.1.2
44
homepage: https://github.com/StringCare/stringcare
55
repository: https://github.com/StringCare/stringcare
66

@@ -18,6 +18,7 @@ dependencies:
1818
crypto: ^3.0.3
1919
flutter_svg: ^2.0.9 # android ios linux macos windows
2020
ffi: ^2.1.0
21+
global_refresh: ^1.0.0 # android ios linux macos web windows
2122
go_router: ^13.0.1 # android ios linux macos web windows
2223
path: ^1.8.3
2324
yaml: ^3.1.2

0 commit comments

Comments
 (0)