只是想知道我们如何在抖动中显示横向和纵向的不同布局。在Android的Native中,我们只创建layout
和layout-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/