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

Semantic versioning #334

Closed savy-91 closed 2 years ago

savy-91 commented 2 years ago

I, like many others, just stumbled upon tests breaking without any reason and No MediaQuery widget ancestor found

After 4 hours of work lost today, trying to find the culprit of the failed tests in some of our commits, I realized that you do not follow Semantic Versioning.

Here is proof:

image

This means that whenever you are making breaking changes and releasing a new minor version, you are breaking all the apps that use your dependency with the default constraint version ^5.0.3 for example.

Why don't you follow semantic versioning?

Here is something for you to read:

Please start using semantic versioning, you will receive less issues and people will be happier.

sohrabonline commented 2 years ago

add ScreenUtil.setContext(context); in builder

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(360, 690),
      minTextAdapt: true,
      builder: () {
        return GetMaterialApp(
          builder: (context, widget) {
            ScreenUtil.setContext(context);
            return MediaQuery(
                data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
                child: widget!);
          },
          debugShowCheckedModeBanner: false,
          theme: settingService.getThemeData(context),
          home: SplashPage(),
        );
      },
    );
  }
lizhuoyuan commented 2 years ago

Sorry, it's my negligence