Flutter 当交互式查看器是容器的子级时,交互式查看器缩放中的问题
我在交互式查看器中缩放图像,交互式查看器是容器的子级,将一些高度设置为容器,缩放图像后,在视口中的特定位置,我无法滚动和缩放图像Flutter 当交互式查看器是容器的子级时,交互式查看器缩放中的问题,flutter,dart,flutter-dependencies,Flutter,Dart,Flutter Dependencies,我在交互式查看器中缩放图像,交互式查看器是容器的子级,将一些高度设置为容器,缩放图像后,在视口中的特定位置,我无法滚动和缩放图像 class MyApp extends StatelessWidget { static const String _title = 'Flutter Code Sample'; @override Widget build(BuildContext context) { return MaterialApp( title: _t
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Zoom(),
),
);
}
}
class Zoom extends StatefulWidget
{
@override
MyStatelessWidget createState()=> MyStatelessWidget();
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends State<Zoom> {
@override
Widget build(BuildContext context) {
return Center(
child:Container(height: 300,
child: InteractiveViewer(
scaleEnabled: true,maxScale: 4.0,
child: Center(
child:Container( child:Image.asset('Assets/Java-001.jpg',fit: BoxFit.cover,alignment: Alignment.center,)),
),
)));
}
}
类MyApp扩展了无状态小部件{
静态常量字符串_title='颤振代码示例';
@凌驾
小部件构建(构建上下文){
返回材料PP(
标题:_标题,
家:脚手架(
appBar:appBar(标题:常量文本(_title)),
主体:缩放(),
),
);
}
}
类Zoom扩展StatefulWidget
{
@凌驾
MyStatelessWidget createState()=>MyStatelessWidget();
}
///这是主应用程序实例化的无状态小部件。
类MyStatelessWidget扩展了状态{
@凌驾
小部件构建(构建上下文){
返回中心(
儿童:集装箱(高度:300,
子:InteractiveViewer(
scaleEnabled:true,maxScale:4.0,
儿童:中心(
子:容器(子:Image.asset('Assets/Java-001.jpg',fit:BoxFit.cover,alignment:alignment.center,),
),
)));
}
}
如何解决此问题?尝试将以下参数添加到InteractiveViewer小部件:
minScale: 0.1,
maxScale: 4.0,
boundaryMargin: const EdgeInsets.all(double.infinity),
constrained: false,