【发布时间】:2021-11-23 10:51:55
【问题描述】:
对于大于横向屏幕的小部件场景,我需要根据设备旋转应用不同的比例。
但是当我应用 0.5 比例时,孩子们被剪掉了。
如果场景在整个屏幕上可见,我应该怎么做才能缩放到 0.5?
/// The scene: the hill, the street and the pump
Widget scene() {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
final bool isLandscape = width > height;
final double scale = isLandscape ? 0.5 : 1;
return // == The custom paint sky
Transform.scale(
scale: scale,
child: Stack(
children: [
Positioned(top: 0, width: 150, child: HillVehicleAnimation()),
【问题讨论】:
标签: flutter widget transform scale