android - 如何在抖动中显示横向和纵向的不同布局

标签 android ios flutter dart flutter-layout

只是想知道我们如何在抖动中显示横向和纵向的不同布局。在Android的Native中,我们只创建layoutlayout-land文件夹,并将xml文件放在其中,系统将自动检测方向的适当布局。
flutter 的任何帮助将不胜感激。谢谢

最佳答案

使用官方小工具,例如docs https://flutter.dev/docs/cookbook/design/orientation

OrientationBuilder(
  builder: (context, orientation) {
    return GridView.count(
      // Create a grid with 2 columns in portrait mode,
      // or 3 columns in landscape mode.
      crossAxisCount: orientation == Orientation.portrait ? 2 : 3,
    );
  },
);

关于android - 如何在抖动中显示横向和纵向的不同布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60611408/

相关文章:

android - 如何在kotlin中实现Android in app purchase?

android - RecyclerView 适合屏幕时不要折叠 Toolbar

ios - 在 Storyboard中的模式堆栈中取消/委托(delegate)第二个 View

android - XING - 如何在 Android 和 iOS 上深度链接两者?

ios - 在核心数据中存储文件路径会引发异常

dart - curl : (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, 错误号 54

android - 将 TreeMap<List<>,List<>> 拆分为两个 ArrayList

android - WorkManager 在工作完成后保持通知

android - 出现错误;没有为类型 '[]' 定义运算符 'Object? Function()'

dart - 在 Flutter 中使用 Expansion Tile 和 ListView