Logo-amall

fix: `widgetbook` does not work with `flutter_screen_utils`

Last active a month ago

6 replies

3 views

  • JE

    Description
    For more context see: https://discord.com/channels/879618555560218625/879725652612374549/1032676427763568731

  • SH

    I'm currently trying to make screenutils friends with widgetbook. There are the following problems:

    There is not enough callback function or access to the current device that was selected with Devices. So ScreenUtils takes the resolution from the MediaQuery.fromWindow or MediaQuery.of(context) depending on the useInheritedMediaQuery parameter (works on ScreenUtilsInit - widget and screen utils 5.6.0)
    If the first problem can be solved through a variable in State, the dimensions are set (according to the size of the device in mediaQuery and in ScreenUtil), but if your widget has a state that changes for example by clicking, then the dimensions in ScreeUtil are set according to the size of the application screen.

  • SH

    I can make a visual example in github or record a video or both)
    https://github.com/shigomany/widgetbook_screenutils

  • SH

    But if i adding inside build method in CounterContainer everything works well:
    ScreenUtil.init(context, minTextAdapt: true);

  • JE

    Sorry that it took a while until we've been able to work on this. Due to #450, we are certain that the MediaQuery is now correctly applied regarding the selected device. In addition, you can now access the selected device by using context.device within the appBuilder.

    Will this already solve the problem?

  • SH

    So I will close this issue

Last active a month ago

6 replies

3 views