OpenFlutter / flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
https://pub.dartlang.org/packages/flutter_screenutil
Apache License 2.0
3.85k stars 486 forks source link

Button Text missing after updating to 5.9.0 #522

Closed byteripper closed 7 months ago

byteripper commented 10 months ago

After updating to 5.9.0 the text on all buttons where i use .sp was missing, but only on the release i uploaded to PlayStore. On all connected, virtual and physical, devices there was no problem.

After going back to 5.8.4 and uploading a new update to PlayStore everything was back to normal.

Iphone user where not reporting any problems yet. So it seams to be a Android problem only.

apriawan0104 commented 10 months ago

me too. after update 5.9.0 my UI not render (text, padding, and other widget using service screen util) my solution is Downgrade version to 5.8.4

hardikkhunt905 commented 9 months ago

facing same issue on Version 5.9.0 I Downgrade version to 5.8.4 but it's not working for me and it's removing image and text from button or normal text randomly only in release/profile build it's perfectly working on debug

AliHoseinpoor commented 9 months ago

i have the same issue.

hardikkhunt905 commented 9 months ago

ensureScreenSize: true, if you do this it may be work for me it's working on latest version and i set this in screenutils and text is showing somehow I don't now what's the specific thing is making issue my another project is working fine with latest library without using any of this parameter and my problem with current project is solved by this ensureScreenSize this is how i use in my code

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) => ScreenUtilInit(
      designSize: appScreenSize,
      ensureScreenSize: true,
      builder: (BuildContext context, Widget? homeChild) => ValueListenableBuilder(
          valueListenable: Utils.appLocal,
          builder: (BuildContext context,Locale value, Widget? child) => GetMaterialApp(
              initialBinding: Binding(),
              navigatorKey: navigatorKey,
              title: MyString.appName,
              //theme
              theme: Get.isDarkMode
                  ? CustomThemes.darkTheme
                  : CustomThemes.lightTheme,
              home: homeChild,
              scrollBehavior: MyCustomScrollBehavior(),
              getPages: Pages.pages,
              onInit: () {
                MediaQuery.sizeOf(context).width > 450
                    ? Utils.isTablet = true
                    : Utils.isTablet = false;
                Debug.setLog('is tablate : ${Utils.isTablet}');
              },
              debugShowCheckedModeBanner: false,
              defaultTransition: Transition.cupertino,
              //translation
              translationsKeys: AppTranslation.translationsKeys,
              locale: value,
              fallbackLocale: const Locale('en', 'US'),
            ),
        ),
    child: const SplashScreen(),
  );
}

if it can help you any way

QixianWu commented 9 months ago

facing same issue on Version 5.9.0 I Downgrade version to 5.8.4 but it's not working for me and it's removing image and text from button or normal text randomly only in release/profile build it's perfectly working on debug

Ensure that your pubspec.yaml declaration is a flutter Screenutil: 5.8.4 instead of flutter Screenutil: ^ 5.8.4

lurongshuang commented 9 months ago

me too. after update 5.9.0 my solution is Downgrade version to 5.8.4

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 7 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

HusseinReda97pro commented 3 months ago

I faced an issue like this in release mode only on Android 14, for Android 9 or ios it works fine, the issue is that screenutil not initiated yet so any extension used returns 0 in my case it was .sp , so the UI is rendered will, but provided value for fontSize was 0 this makes texts disappear,

In my case, this was because I used (xx.sp) in static variables, which try to calculate before screenutil initiated, so my solution Is not to use .sp in static variables instead make a class and initialize one instance from it to be used throw the app, and initiated it in screenutil builder, this fix the issue with me