定义变量 final _transformationController = TransformationController();
- InteractiveViewer(
- maxScale: 4,
- //panEnabled: true,
- // scaleEnabled: true,
- transformationController: _transformationController,
- child: GestureDetector(
- onTap: (){
- print("单击");
- },
- onDoubleTap:(){
- print(_transformationController.value.getMaxScaleOnAxis()); //获取当前缩放位数
- print("双击");
- },
- child: Image.network(
- imLogic.userInfo.value.faceURL!, // 替换为你的图片地址
- fit: BoxFit.fitWidth,
- ),
- ),
- );
复制代码
flutter InteractiveViewer 获取当前缩放倍数 transformationController 转载要声明在藏宝库:28xin.com哦 |