flutter InteractiveViewer 获取当前缩放倍数 transformationController

siman 2024-5-13 22:08:34 191 0 来自 中国
定义变量  final _transformationController = TransformationController();

  1. InteractiveViewer(
  2.                                     maxScale: 4,

  3.                                       //panEnabled: true,
  4.                                      // scaleEnabled: true,

  5.                                      transformationController: _transformationController,

  6.                                         child: GestureDetector(
  7.                                           onTap: (){


  8.                                             print("单击");
  9.                                           },

  10.                                           onDoubleTap:(){
  11.                                             print(_transformationController.value.getMaxScaleOnAxis()); //获取当前缩放位数
  12.                                             print("双击");
  13.                                           },
  14.                                           child: Image.network(
  15.                                             imLogic.userInfo.value.faceURL!, // 替换为你的图片地址
  16.                                             fit: BoxFit.fitWidth,
  17.                                           ),
  18.                                         ),


  19.                                   );
复制代码


flutter InteractiveViewer 获取当前缩放倍数 transformationController  转载要声明在藏宝库:28xin.com哦
您需要登录后才可以回帖 登录 | 立即注册

Powered by CangBaoKu v1.0 小黑屋藏宝库It社区( 冀ICP备14008649号 )

GMT+8, 2024-9-8 08:53, Processed in 0.152022 second(s), 35 queries.© 2003-2025 cbk Team.

快速回复 返回顶部 返回列表