-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird scaling of whole flutter view #435
Comments
I think this happens when the flutter controllers all have different sizes, it takes the size from the last one and scales by it |
hi, Xioshock, |
Yes they are all in dart, but have custom transition and the modal is a child of different UIViewController. I'll provide example in a bit. |
I modified the swift example so it produces the bug: repo Just build it in xcode, click Start and wait. It will push "first" and then "second" flutter widget with smaller sized window. If you go back to "first" it will be scaled. |
I can reproduce it now, seems related to the underlying surface painting. I will work on it, but not sure when it will be solved. |
hi Xioshock, - (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if([self.name isEqualToString:@"second"]){
self.view.frame = CGRectMake(0, 0, 375, 812);
}
} then, in the onClickPushFlutterPage function, you can push the SECOND page like this: DispatchQueue.main.asyncAfter(wallDeadline: .now() + 2) { [weak self] in
let vc = UIViewController()
vc.view.backgroundColor = .blue;
let flutterVC = MyFlutterVC.init();
flutterVC.view.backgroundColor = .white
flutterVC.setName("second", params: [:])
vc.addChildViewController(flutterVC)
vc.view.addSubview(flutterVC.view)
// this is just to show that the bug occurs when controllers have different sizes.
flutterVC.view.frame = CGRect(x: 0, y: 0, width: 400, height: 400)
self?.navigationController?.pushViewController(vc, animated: true)
} |
The root cause is Flutter's underlying draw mechanism, which only support single window. However, in the flutter boost, we try to support more than one VC, it is conflict with previous assumption. |
Be more specific, when you change the frame of VC, it will updateViewportMetrics, which finally change the size of Window(owned by flutter). The window is global, and shared by all dart objects. Consequently, when you pop back to the first, the layer is drew incorrectly due to the size change of window. |
I see. Thank you, I'll try it out tommorow |
thank you, it works. If anyone else is interested, this is enough:
|
I found that if there is a keyboard input event, there will be a problem with zooming. |
Yes, i came across it as well recently. Not sure what's causing it. |
I have a weird issue with scaling that I cannot fix. Look at these screenshots:
This is the correct state, how it should look:
[DELETED]
Then I go to another modal flutter screen, it's just a popup over this one:
[DELETED]
And finally when I dismiss the popup, the scaling is wrong on the original screen:
[DELETED]
It's doing it even even native push/pop transition. Do you have any idea how to fix this?
edit: I deleted the images, not sure if i can post these online yet.
The text was updated successfully, but these errors were encountered: