Orientation Builder gives wrong orientation
It’s already said in the documentation that
OrientationBuilder builds a widget tree that can depend on the parent widget's orientation (distinct from the device orientation).
In my case when soft keyboard is opened, width of the screen becomes greater than height(Note that I’m calculating the height as Full Screen Height – Soft Keyboard height.
Thus OrientationBuilder returns as
landscape which is the
correct behaviour as per documentation.
OrientationBuilder cannot be used for this case.
To solve the issue we can use orientation obtained from
MediaQuery.of(context).orientation == Orientation.portrait ? 5 : 8
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.