New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All text in the app is invisible #350
Comments
Here is a code sample on how I instantiate the package: @override
Widget build(BuildContext context) {
return MediaQuery(
data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window),
child: ScreenUtilInit(
designSize: ScreenUtil.defaultSize,
builder: () => GetMaterialApp(
title: 'Unisport',
debugShowCheckedModeBanner: false,
translations: AppTranslations(),
locale: window.locale,
fallbackLocale: const Locale('hr', 'HR'),
themeMode: themeController.themeMode,
theme: lightTheme,
darkTheme: darkTheme,
home: SplashScreen(),
builder: (ctx, child) {
ScreenUtil.setContext(ctx);
return child!;
},
),
),
);
} |
did you find solution? i also faced this problem on release mode after several run. Example 10 times open app 3 times will throw missing font size |
Nope, seems like the issue is still present. This absolutely crushed our plans of releasing the app on the date that we were supposed to.. |
Ok, somehow the issue seems to be resolved. I resolved it by doing the following steps:
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
builder: () => GetMaterialApp(
title: 'Unisport',
debugShowCheckedModeBanner: false,
translations: AppTranslations(),
locale: window.locale,
fallbackLocale: const Locale('hr', 'HR'),
themeMode: themeController.themeMode,
theme: lightTheme,
darkTheme: darkTheme,
home: SplashScreen(),
builder: (ctx, child) {
ScreenUtil.setContext(ctx);
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child!,
);
},
),
);
}
} |
@FlawLessx Here is the solution that worked for me btw :) |
@lizhuoyuan This issue should definitely be resolved ASAP as this is affecting a lot of people and your package is very important :) (If you need help fixing this message me somehow and we will investigate the issue together). I am not going to close this issue as this is just a hotfix, not a real solution. If you don't agree with me, that's okay, you can go ahead and close the issue. |
@BrunoJurkovic Unfortunately it didn't work, for me how to deal with it with overriding fontSize from themeData like |
I'm sorry, could you please rephrase your question? |
It's worked for me as well
|
I'm using Theme and inside Theme I added textStyle with .sp, so I can't fix this issue until wrap widget which is into Builder with Theme
|
It should work for you, make sure you're using the first initialization method. |
Mine wasn't showing any text, and widget that was using the Screen Util .h or .w (widgets that were using only numbers for their height, width, with no Screen Util usage, were showing normally...) I'm now using version 5.0.3 which is working. |
@lizhuoyuan Please check the my Pull Request #352 and tell if it fixed the problem. @jacaTM @BrunoJurkovic and anyone else, please try this trick that worked for me. // Add this function
Future<void> _ensureScreenSize(window) async {
return window.viewConfiguration.geometry.isEmpty
? Future.delayed(
const Duration(milliseconds: 10),
() => _ensureScreenSize(window)
)
: Future.value();
}
void main() async {
// Add these lines before calling ScreenUtil.init()/ScreenUtilInit()
// Better add these lines before runApp() if you are using native splash screen
final window = WidgetsFlutterBinding.ensureInitialized().window;
await _ensureScreenSize(window);
runApp(const MyApp());
} |
any update regarding this issue ? |
@adnankhan74444 My trick doesn't work for you ? |
to solve this issue remove any api in the theme |
… (#352) * Fix initializing with Size(0, 0) Only in Production Mode, Flutter starts quicker and the native platform reports the actual resolution in a certain delai. This update only wait for the real resolution. * Upgrade to latest gradle version and enable Jetifier and use AndroidX * Update example flutter version * Optimize BugFix and some boilerplate removal * Update example app * Fix creating adaptive radius using extension * Update example/ios/.gitignore * Update README.md * Update screenutil_init.dart
Mounir-Bouaiche. your solution worked for me . thanks alot! |
simply use This version works well |
The issue still persist if u use sp in Apptheme here is a fix for latest version.
|
My app took forever to load. I am using a native splash screen and i added the code as well |
Description
All of the text in the app is invisible, this seems to be a reoccurring problem with this package and is preventing us from releasing the app.
Where it occurs
We have noticed that this bug occurs on Android, specifically on release mode. I am unable to reproduce this bug on my iOS simulator or my Android simulator.
What I have done to mitigate this
setContext()
.ScreenUtilInit
widget with aMediaQuery
and passed itdata: MediaQueryData.fromWindow(WidgetsBinding.instance!.window)
home
parameter of the MaterialApp.Extra Info + Image
The text was updated successfully, but these errors were encountered: