【问题标题】:how to zoom page in flutter如何在颤动中放大页面
【发布时间】:2021-03-30 17:42:56
【问题描述】:

我想使用按钮来缩放我的页面,而不仅仅是图像

【问题讨论】:

  • 欢迎来到 Stack Overflow!我想为您分享一些建议,以尝试改进您的帖子和未来的帖子,尝试分享更多信息,例如,您尝试了什么,您拥有的代码的 sn-p 以及您想要实现的目标,在这种情况下,我不确定您是要添加缩放功能还是浮动按钮。我建议您使用更多信息编辑您的问题。
  • 检查您使用的标签。您标记了这个“zoom-sdk”,这是 Zoom 平台的 SDK。你是这个意思吗?

标签: flutter


【解决方案1】:

看起来你正在寻找这个,zoom_widget,但它使用手势 inst

Zoom(
    width: 1800,
    height: 1800,
    child: Center(
        child: Text("Happy zoom!!"),
    )
);

zoomer,使用控制器设置Scale:

  ZoomerController _zoomerController = ZoomerController(initialScale: 1.0);
  String _zoomDetails = "Zoom";  

  @override
  Widget build(BuildContext context) {

    _zoomerController.onZoomUpdate((){
      setState(() {
        _zoomDetails = "Scale = "+ _zoomerController.scale.toStringAsFixed(2);
        _zoomDetails += "\nRotation = "+ _zoomerController.rotation.toStringAsFixed(2);
        _zoomDetails += "\nOffset = ("+ _zoomerController.offset.dx.toStringAsFixed(2)+","+_zoomerController.offset.dy.toStringAsFixed(2)+")";
      });
    });

    return Scaffold(
      appBar: AppBar(title: Text("Zommer Example"),),
      body:
        Center(child:
        Stack(
          children: [
            Align(alignment: Alignment.topCenter,child: SizedBox(height: 150,child: Text(_zoomDetails,textAlign: TextAlign.center,style: TextStyle(fontSize: 30),))),
            Center(
              child: 
                Zoomer(
                  enableTranslation: true,
                  enableRotation: true,
                  clipRotation: true,
                  maxScale: 2,
                  minScale: 0.5,
                  background:BoxDecoration(color: Colors.white),
                  height: 300,
                  width: 300,
                  controller: _zoomerController,
                  child: Container(decoration: BoxDecoration(color: Colors.green),height: 200,width: 200,child: FlutterLogo(),)),
            ),
          ])),
    );
  }
}

【讨论】:

    猜你喜欢
    • 2019-01-16
    • 1970-01-01
    • 2021-11-19
    • 2020-08-03
    • 2021-12-21
    • 1970-01-01
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    相关资源
    最近更新 更多