【问题标题】:showing multiple portrait view screens in one single screen in landscape view in flutter在颤振中以横向视图在一个屏幕中显示多个纵向视图屏幕
【发布时间】:2021-10-20 01:18:15
【问题描述】:

我正在开发一款餐厅应用程序,它与移动设备和平板电脑相冲突。我面临的问题是在移动视图中我有这些屏幕(汉堡,三明治,...类别屏幕 LHS),(中间的产品屏幕)和(RHS 的购物车屏幕)。但在平板电脑屏幕中,我将这些屏幕作为一个屏幕。那么如何在一个屏幕中以横向视图(平板电脑)显示所有这些屏幕。

感谢任何帮助或指导!!!谢谢

【问题讨论】:

    标签: flutter user-interface mobile tablet landscape-portrait


    【解决方案1】:

    用 OrientationBuilder 包裹父部件 这使您可以根据屏幕方向访问设置条件。

    OrientationBuilder(
       builder: (context, orientation) {
        return GridView.count(
         crossAxisCount: orientation == Orientation.portrait ? 2 : 3,
       );
      },
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-10
      • 1970-01-01
      • 2014-03-14
      • 1970-01-01
      • 2011-01-26
      • 2021-01-24
      • 2016-12-08
      相关资源
      最近更新 更多