📜  基于设备方向的颤振显示小部件 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:03.830000             🧑  作者: Mango

代码示例1
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'
        }