flutter screen orientation code example
Example 1: lock screen orientation flutter
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.orientation_lock_example"> <application ...> <activity android:name=".MainActivity" android:screenOrientation="portrait" ... /> ... </activity> ... </application></manifest>
Example 2: flutter display widget based on device orientation
build(BuildContext context) {
final isLandscape = MediaQuery.of(context).orientation ==
Orientation.landscape;
if (!isLandscape) txListWidget,
if (isLandscape)
_ternaryCondition ? _showFirstWidget : _showSecondWidget
}