Answers for "landscape in flutter"

1

flutter display widget based on device orientation

build(BuildContext context) {
    final isLandscape = MediaQuery.of(context).orientation ==
        Orientation.landscape; // check if the orientation is landscape
        
        
        // further down your code you can use 'if' or 'ternary' or both
        if (!isLandscape) txListWidget,
            if (isLandscape)
            _ternaryCondition ? _showFirstWidget : _showSecondWidget
            // the above widgets would be in a 'Row' or 'Column'
        }
Posted by: Guest on November-18-2020
0

set orientation to landscape flutter

SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft,DeviceOrientation.landscapeRight])
Posted by: Guest on June-15-2021

Code answers related to "landscape in flutter"

Browse Popular Code Answers by Language