App is confusing between application orientation - flutter

I applied SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); to my second page of application when I click on button to go new screen where I set portrait orientation my application firstly show in portrait orientation and change its orientation for 1 second to landscape and after 1 second it set back to portrait. I am calling SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); in build function for each class.

Do not change orientation on different screen. where you need to change the orientation just put your screen into rotated box and rotate it to change orientation by quarterTurns: 2,. Rotatedbox

Related

Half black screen is visible when device orientation changes from portrait to landscape

I'm using InfiniteCollectionView class, Once I change the device Orientation from portrait to landscape, half the screen looks black for a second
I have also tried the viewWillTransition function by doing the same but I didn't get success

How to switch the live screen camera icons from portrait to landscape mode in iPhone?

I created a custom camera overlay for the live screen camera view and have imported my own custom icons for the camera, flash and flip buttons. Everything looks good in portrait mode, but when I switch the live camera screen to landscape mode, the orientation of the camera stays in portrait mode and shows this in console,
"Error: CGAffineTransformInvert: singular matrix"
I tried using the auto resizing mask, also have tried setting two different frames for the icons in both portrait and landscape mode in didRotateFromInterfaceOrientation method. But none of these are working.
My question is, will the landscape orientation support only the default iPhone camera overlay view or will it also support the custom overlayview.
Here are the screenshots indicating the behaviour of the icons repositioning each other when switched from portrait to landscape mode. I want exactly like this in my custom overlay view.
Edit:
I've made the live screen of my custom camera overlay to change by using the UIDevice Orientation method. But right now, the frame is not resizing when i try to switch from the portrait to landscape mode. So, i just want the entire frame to resize in landscape mode. Also, in this piece of code, if i try to change the value of CAMERA_TRANSFORM_Y,
#define CAMERA_TRANSFORM_X 1
#define CAMERA_TRANSFORM_Y 1.234
self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
the size of the overlay view reduces both from the top and bottom margin. But, more size gets reduced from the bottom than from the top margin. I want the overlay size to change uniformly both from the top and from the bottom margin.
This is my sample code,
Sample project

Forcing a UIVIew to lay itself out for the current device orientation

I've been working on this for days and can't crack it. The sequence of events is:
In landscape (let's just say right), the user hits an "edit" button.
A portrait only modal interface slides in. Its shouldAutorotateToInterfaceOrientation returns yes only for portrait.
The device becomes convinced it is in portrait mode.
Problem 1: If the user dismisses the interface without having actually rotated to portrait mode, the device reports that is in landscape right orientation (which it is), but the interface is laid out in portrait orientation.
Problem 2: If the user rotates to portrait, the interface does not get laid out again.
Problem 3: (And this one is weird) Rotating back to the same landscape orientation (right) where the edit button was pressed causes the status bar to return to landscape, but nothing else changes. All my stuff remains laid out in portrait mode. Rotating to the other (left) landscape orientation works perfect.
I need some way to force the layout engine to redo the layout for the orientation the device is actually in.
UIView - layoutSubviews, - setNeedsLayout, and -layoutIfNeeded don't have any effect.
Thanks for any help.
Do what iBooks (2.x) does and force the interface orientation to portrait with
+ (void)attemptRotationToDeviceOrientation. This way, you nip the problem in the bud at step one.

Drawing UI components when device orientation changes

When I open any form in my app in Portrait mode and tap on any textfield (keyboard pops up) and then change the device orientation to landscape, page is no longer scrollable to bottom most UI widgets. But if you open the same page directly in Landscape mode, it works fine
I think idea should be like:
1. Capture the change in device orientation
2. Change the frames of UI components as required
3. Redraw the screen
Please suggest.
You simply set adjust your frame for landscape mode.. U did not allocate memory just adjust frame only...

Portrait Orientation is losing touch input

I'm making a universal apps with auto rotation, and I'm only using landscape left and right. When I rotate the iPhone to the portrait down position, I can see what looks like a window underneath the app rotating and I no longer get touch events.
In all the shouldAutoRotate functions I'm making sure only return true for landscape, and the info.plist only allows landscape left and right.
Sounds like your view is not correctly resizing after an orientation change. Easy way to check this is to set the background color to something non-white.