InteractiveViewer(
child: FlutterLogo(size: 1000),
)
FlutterLogo
比视口(viewport)大,因此我将其包装在 InteractiveViewer
中,但它没有平移。我检查了 panEnabled
,默认情况下它是 true
。我错过了什么?
最佳答案
如果您的小部件大于视口(viewport),则需要将 constrained
设置为 false
。
constrained: If set to false, then the child will be given infinite constraints. This is often useful when a child should be bigger than the InteractiveViewer.
InteractiveViewer(
constrained: false, // Set it to false
child: FlutterLogo(size: 1000),
)
关于Flutter InteractiveViewer 无法平移/滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64800636/