简体   繁体   English

Flutter:如何将 InteractiveViewer 与固定大小的孩子一起使用?

[英]Flutter: How to use InteractiveViewer with a fixed size child?

I'd like to have a fixed size artboard, say 1280x1280, and just allow it to be viewable on all devices.我想要一个固定大小的画板,比如 1280x1280,并让它在所有设备上都可以查看。 With a small amt of padding around it.周围有一小块填充物。

No matter what size I give the child content, InteractiveViewer seems to force the contents match my viewport aspect ratio, and then apply padding to those bounds.无论我为子内容提供什么大小,InteractiveViewer 似乎都会强制内容与我的视口纵横比相匹配,然后将填充应用于这些边界。

Think Sketch or Figma, the size of the artboard doesn't change, just the viewport does.想想 Sketch 或 Figma,画板的大小不会改变,只是视口会改变。

Self answering this, it's constrained: false : https://api.flutter.dev/flutter/widgets/InteractiveViewer/constrained.html自我回答这个问题,它constrained: falsehttps://api.flutter.dev/flutter/widgets/InteractiveViewer/constrained.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM