responsive_builder icon indicating copy to clipboard operation
responsive_builder copied to clipboard

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

Open marctan opened this issue 2 years ago • 10 comments

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

marctan avatar Jun 03 '22 01:06 marctan

@marctan how about 3.0.5?

Eimen2018 avatar Aug 11 '22 15:08 Eimen2018

Seems like this is similar to #49

tsquillario avatar Mar 14 '23 21:03 tsquillario

@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.

FilledStacks avatar Mar 15 '23 12:03 FilledStacks

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.

kydav avatar Mar 24 '23 14:03 kydav

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

h4h13 avatar Mar 25 '23 23:03 h4h13

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

FilledStacks avatar Mar 26 '23 16:03 FilledStacks

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

h4h13 avatar Mar 30 '23 08:03 h4h13

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

FilledStacks avatar Mar 31 '23 04:03 FilledStacks

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

h4h13 avatar Mar 31 '23 04:03 h4h13

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.

FilledStacks avatar Apr 10 '23 15:04 FilledStacks