Closed phamquoctrongdev closed 3 years ago
Hi @pqtrong17 , In this moment the only method that you have is to listen the _localeStream inside FlutterI18n class. How do you change the language?
I would like to add a new stream with the loading status: @defint what do you think?
Sorry, my English is not good. I get a error not found a key for translate because json file is not finish. I need a bool value to listen.
@ilteoood Yes, nice to have this feature to prevent a lot of issues.
@defint I forgot to create a new branch. Can you give me a feedback about this? https://github.com/ilteoood/flutter_i18n/commit/f00daf72287f91d3de1a565c9ffd69b079225050
@ilteoood Looks good, but I have some comments: 1) I would create another getter with a transformed stream (https://api.flutter.dev/flutter/dart-async/Stream/transform.html). Transformed stream should return a boolean value to easy usage. I, as a user, don't want to import enum and listen notLoaded / loading values. 2) Documentation with the example of usage will be helpful
@pqtrong17 support has been implemented in this commit: https://github.com/ilteoood/flutter_i18n/pull/136/commits/6c552379b46c156aac3bed33637c4a89a55b075b
It'll be available with version 0.20.0
@ilteoood If I combine with StreamBuilder, When I call setState, I get a error:
Bad state: Stream has already been listened to.
@pqtrong17 how are you using it? I've made an example of usage here: https://github.com/ilteoood/flutter_i18n/blob/420fb66bac326bb438c5092a4274151a98c20eb0/example/lib/network_example.dart#L64
I use NetworkFileTranslationLoader to load json file from my server. But when I switch between languages there is a delay (a few seconds). I want to show CircleLoading while waiting for the json file to download. How do I do this?