FilledStacks / responsive_builder

A set of widgets to make responsive UI building in flutter more readable
MIT License
497 stars 81 forks source link

[ios] Multiple Rebuild issue on 2.10.5 and 3.0.1 when opening keyboard #41

Open marctan opened 2 years ago

marctan commented 2 years ago

Hello, there's an issue with flutter 2.10.5 when opening keyboard and using responsive_builder. It will call build and didChangeDependencies multiple times. This is not happening in 2.8.1.

2.8 video below:

https://user-images.githubusercontent.com/19194749/171528794-777f5898-1077-4cad-9fce-fe83235788bc.mov

2.10.5 and 3.0.1 video below

https://user-images.githubusercontent.com/19194749/171528700-e5351981-514f-43a3-a7e8-e24b06257e6b.mov

You can use this sample demo: https://github.com/marctan/demo_rebuild @FilledStacks

Eimen2018 commented 2 years ago

@marctan how about 3.0.5?

tsquillario commented 1 year ago

Seems like this is similar to #49

FilledStacks commented 1 year ago

@marctan We use the "natural" flutter rebuild path. I know the build function also does this for the keyboard, dialogs, bottom sheets and notifications / minimise.

I'll see if it's any different from base flutter, if it is I'll make an adjustment if I can update the functionality.

kydav commented 1 year ago

This is actually causing some issues, I don't think the version of flutter has much to do with it. I had thought it was the version of flutter but realized after switching around some things that it was actually updating Responsive_builder from 0.5.0 to 0.6.4 that caused some issues for us. The interesting part is that I don't see this in flutter beta channel current version.

You can see that when I use ScreenTypeLayout.builder for this widget, and try to use the system keyboard it opens quickly and closes. If I create the widget without any responsive builder it works just fine:

This is without Responsive builder https://user-images.githubusercontent.com/10816342/227561282-c02a4be7-5bd4-483b-8890-97f351ea0887.mov

This is with Responsive Builder https://user-images.githubusercontent.com/10816342/227561432-49f11674-3980-4b2a-819a-4506930377d3.mov

Updating to add that with the upgrade, we also went from using the ScreenTypeLayout() to the ScreenTypeLayout.builder()

So adding more info as I discover it. It appears that going back to ScreenTypeLayout() fixes the issue. Also interesting to note that just using: getDeviceType(MediaQuery.of(context).size) causes the same rebuilding issue that causes the keyboard to open and close.

h4h13 commented 1 year ago

This is actually causing some issues, I don't think the version of flutter has much to do with it. I had thought it was the version of flutter but realized after switching around some things that it was actually updating Responsive_builder from 0.5.0 to 0.6.4 that caused some issues for us. The interesting part is that I don't see this in flutter beta channel current version.

You can see that when I use ScreenTypeLayout.builder for this widget, and try to use the system keyboard it opens quickly and closes. If I create the widget without any responsive builder it works just fine:

This is without Responsive builder https://user-images.githubusercontent.com/10816342/227561282-c02a4be7-5bd4-483b-8890-97f351ea0887.mov

This is with Responsive Builder https://user-images.githubusercontent.com/10816342/227561432-49f11674-3980-4b2a-819a-4506930377d3.mov

Updating to add that with the upgrade, we also went from using the ScreenTypeLayout() to the ScreenTypeLayout.builder()

So adding more info as I discover it. It appears that going back to ScreenTypeLayout() fixes the issue. Also interesting to note that just using: getDeviceType(MediaQuery.of(context).size) causes the same rebuilding issue that causes the keyboard to open and close.

I had dug through this because I'm also facing the issue, for my understanding when the system keyboard opens the widget rebuilds because the screen size changes, why it happens pub uses MediaQuery so any changes to MediaQuery changes to widget

Thanks for confirm will roll back to previous version

FilledStacks commented 1 year ago

Thanks for confirming this I'll look into it. I wonder what could be causing this. I appreciate the details and updating the issue.

h4h13 commented 1 year ago

IDK how to put that code in collapsable let me if it helps

FilledStacks commented 1 year ago

@h4h13 I don't know what the above logs are for.

h4h13 commented 1 year ago

Ignore thought it would help you to work on that media query bug

FilledStacks commented 1 year ago

Thanks. I appreciate the additional info, I'll tend to this as soon as I get past some of the course creation hurdles we're facing right now.