OpenFlutter / flutter_screenutil

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

New Version version flutter_screenutil 5.1.1 is not working with GetMaterial App #337

Closed parmeetmaster closed 2 years ago

parmeetmaster commented 2 years ago

Hello sir,

my code was working fine with the previous version but after updating plugin my Get material app is not working fine

  return ScreenUtilInit(
        designSize: Size(412, 847),
        builder: () => GetMaterialApp(
              builder: EasyLoading.init(),
              debugShowCheckedModeBanner: false,
              navigatorObservers: <NavigatorObserver>[FirebaseUtils.observer],
              theme: ThemeData(
                scaffoldBackgroundColor: AppColors.WHITE,
                appBarTheme: AppBarTheme(
                  systemOverlayStyle: SystemUiOverlayStyle.light,
                ),
                primaryColor: AppColors.THEME_COLOR,
                backgroundColor: AppColors.WHITE,
                radioTheme: Theme.of(context).radioTheme.copyWith(
                    fillColor:
                        MaterialStateProperty.all(AppColors.BLUE_PRIMARY)),
                textTheme: GoogleFonts.robotoTextTheme(
                  Theme.of(context).textTheme,
                ),
                visualDensity: VisualDensity.adaptivePlatformDensity,
                colorScheme: Theme.of(context)
                    .colorScheme
                    .copyWith(secondary: AppColors.BLACK)
                    .copyWith(secondary: AppColors.THEME_COLOR),
              ),
              home: SplashScreen(),
            ));

This is error showing below WhatsApp Image 2022-02-09 at 2 43 38 PM

brownlawne commented 2 years ago

修改成如下即可: return MediaQuery( data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window), child: ScreenUtilInit(