Comments (3)
Quick update on this. I just built the app I'm working on in release mode on my physical device and I'm not experiencing this issue! It definitely is noticeable in the emulator and not there without this package, but as far as I'm concerned since it works perfectly in release mode this issue might be able to be closed. I haven't tested the example app yet on my device, but I'm sure it works the same.
from flutter_translate.
This is definitely an issue, I could reproduce it on the emulator and from what I can see there are some other open issues (such as flutter/flutter#22007 and flutter/flutter#20827) regarding this behavior.
In our case here, it seems the problem is the localization initialization by Flutter, which happens right after the splash screen is closed and before the main (app) widget is rendered.
If we force the localization initialization before runApp (by calling delegate.changeLocale
), the issue is gone, as the localization is initialized during the splash screen instead.
Ex:
void main() async
{
WidgetsFlutterBinding.ensureInitialized();
var delegate = await LocalizationDelegate.create(fallbackLocale: 'en_US',supportedLocales: ['en_US', 'es', 'fa']);
delegate.changeLocale(Locale('en_US'));
runApp(LocalizedApp(delegate, MyApp()));
}
The problem with this is that on first startup, the current device locale should be used (if supported by the application).
So I think the solution here, in order to have the default locale used on startup and not to have this black screen behavior, is to retrieve the current device locale and initialize it before runApp, instead of letting Flutter decide when to initialize it.
This could be implemented directly in the LocalizationDelegate.create
method.
from flutter_translate.
Thanks for the update on this! I'm going to look into implementing that if you haven't already gotten to it before I do.
from flutter_translate.
Related Issues (20)
- Update packages HOT 4
- Parent Widget not updated HOT 2
- Add information for the deprecated flutter_translate_gen HOT 4
- No MaterialLocalizations found , If change language to Soomaali (so) HOT 2
- reverse back when change language HOT 1
- Language changes, then falls back to default language
- Possible to translate a specific widget? HOT 1
- Simplify configuration & initialization
- Implement a missing key strategy HOT 1
- Implement remote (http) localization loader HOT 1
- universal_io, Question about? HOT 1
- Why flutter_translate_gen has been archived? HOT 1
- Wiki updates HOT 4
- Load translations from web HOT 2
- Wrap LocalizationProvider for Cubit / BLoC package HOT 1
- Pluralization feature not working for static keys HOT 5
- Localization Issue with OS language changes HOT 1
- Test for web platform is not working HOT 1
- Not fiend flutter_localizations GlobalMaterialLocalizations error HOT 1
- en.json missing from assets HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_translate.