Skip to content
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

some text widgets in build mode is missing #558

Open
Akshaykakkodi opened this issue Mar 27, 2024 · 7 comments
Open

some text widgets in build mode is missing #558

Akshaykakkodi opened this issue Mar 27, 2024 · 7 comments

Comments

@Akshaykakkodi
Copy link

When building app in release mode some text widgets are missing.

ScreenUtilInit(
designSize: Size(430, 932),
minTextAdapt: true,
splitScreenMode: true,

    builder: (context,child) {
      return MaterialApp(
        theme: ThemeData(
          textSelectionTheme: TextSelectionThemeData(
            cursorColor: AppColors.lightGrey,
          ),
          
          dialogTheme: DialogTheme(backgroundColor: AppColors.white),
          inputDecorationTheme: InputDecorationTheme(
            counterStyle: AppTextStyles.text14Black400,
            hintStyle:  TextStyle(fontSize: 14.h, fontWeight: FontWeight.w400),
            contentPadding: EdgeInsets.only(left:16.h,right: 16.h),
            constraints:  BoxConstraints(maxHeight: 56.h),
          ),
          hintColor: AppColors.lightGrey,
          fontFamily: GoogleFonts.poppins().fontFamily,
          colorScheme: ColorScheme.fromSeed(seedColor: AppColors.white),
          useMaterial3: true,
        ),
        routes:AppRoutes.routes,
    
        initialRoute: '/',
   
        
      );
    }
  ),
);

}
}

@sagnik-sanyal
Copy link

sagnik-sanyal commented Mar 29, 2024

I am also having this same issue, did you find a way to resolve this @Akshaykakkodi ?

@YuchenTOR
Copy link

try use 5.8.4

@mozomig
Copy link

mozomig commented Apr 10, 2024

same problem

@mozomig
Copy link

mozomig commented Apr 10, 2024

I'm find solution for 5.9.0, it's happens because in release mode when starting app screen width and screen height in ScreenUtil instance was 0 and fontSizeResolver calculate scale font incorrect.

My solution:

final designSize = const Size(412, 892);

ScreenUtilInit(
          designSize: designSize,
          fontSizeResolver: (fontSize, instance) {
            final display = View.of(context).display;
            final screenSize = display.size / display.devicePixelRatio;
            final scaleWidth = screenSize.width / designSize.width;

            return fontSize * scaleWidth;
          },
          builder: (context, _) {
              return MaterialApp.....
})

@hmartiins
Copy link

I'm find solution for 5.9.0, it's happens because in release mode when starting app screen width and screen height in ScreenUtil instance was 0 and fontSizeResolver calculate scale font incorrect.

My solution:

final designSize = const Size(412, 892);

ScreenUtilInit(
          designSize: designSize,
          fontSizeResolver: (fontSize, instance) {
            final display = View.of(context).display;
            final screenSize = display.size / display.devicePixelRatio;
            final scaleWidth = screenSize.width / designSize.width;

            return fontSize * scaleWidth;
          },
          builder: (context, _) {
              return MaterialApp.....
})

Work for me! Thanks!

@spring321
Copy link

spring321 commented Apr 20, 2024

我找到了 5.9.0 的解决方案,发生这种情况是因为在发布模式下启动应用程序时 ScreenUtil 实例中的屏幕宽度和屏幕高度为 0 并且 fontSizeResolver 计算比例字体不正确。

我的解决方案:

final designSize = const Size(412, 892);

ScreenUtilInit(
          designSize: designSize,
          fontSizeResolver: (fontSize, instance) {
            final display = View.of(context).display;
            final screenSize = display.size / display.devicePixelRatio;
            final scaleWidth = screenSize.width / designSize.width;

            return fontSize * scaleWidth;
          },
          builder: (context, _) {
              return MaterialApp.....
})

None of the above works for me

[✓] Flutter (Channel stable, 3.19.3, on macOS 14.3.1 23D60 darwin-arm64 (Rosetta), locale zh-Hans-CN)
• Flutter version 3.19.3 on channel stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ba39319843 (6 weeks ago),
• Engine revision 2e4ba9c6fb
• Dart version 3.3.1
• DevTools version 2.31.1
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

In version 5.9.0, Android phones can run with the screen off and wiget will be missing

@Mounir-Bouaiche
Copy link
Collaborator

@spring321 @hmartiins @mozomig @sagnik-sanyal @Akshaykakkodi Can you try latest version 5.9.2 and see, if problem persist, thanks. Also read #568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants