如何避免浏览器缩放,当按 ctrl+ 放大 flutter web 时

问题描述

在下面的代码中,我只是在容器内添加一个图像,我使用交互式查看器进行缩放

 import 'package:Flutter/material.dart';
void main()
{
  runApp(MyApp());
}
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 Container(height: 1500,child: InteractiveViewer(
                child:Container( child:Image.asset('assets/pdfpage.png',fit: BoxFit.fitWidth)),)
    );
  }
}

enter image description here

在最大缩放级别

enter image description here

在最小缩放级别

需要单独缩放容器小部件,我使用 ctrl+mousewheelscroll 在 Flutter web 中缩放图像,appbar 和整个网页都被缩放。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)