只是想知道我们如何在抖动中显示横向和纵向的不同布局。在适用于Android的Native中,我们仅创建layout
并layout-land
文件夹xml文件并将其放置在其中,系统将自动检测方向的适当布局。扑扑的任何帮助将不胜感激。谢谢
使用像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,
);
},
);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句