【问题标题】:Flutter - PhotoView颤振-PhotoView
【发布时间】:2021-09-29 07:28:07
【问题描述】:

告诉我,是否可以增加(或减少)“照片视图”小部件中的图像,以便在将手指从屏幕上移开后将图像恢复到其原始状态?或者是否可以使用其他小部件来实现这一点?

【问题讨论】:

标签: flutter photoview


【解决方案1】:

您可以使用此pinch_zoom_image_last 包在 pub dev 中完成此操作。您可以使用以下代码作为示例。

import 'package:flutter/material.dart';
import 'package:pinch_zoom_image_last/pinch_zoom_image_last.dart';

class ZoomWidget extends StatelessWidget {
  final String imagePath;

  ZoomWidget(this.imagePath);

  Widget build(BuildContext context) {
    return PinchZoomImage(
      image: Image.network(imagePath),
      zoomedBackgroundColor: const Color.fromRGBO(240, 240, 240, 1.0),
      // hideStatusBarWhileZooming: true,
      onZoomStart: () {
        print('Zoom started');
      },
      onZoomEnd: () {
        print('Zoom finished');
      },
    );
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-15
    • 2021-07-04
    • 2019-01-10
    • 1970-01-01
    • 2019-07-14
    • 2020-10-02
    • 2021-04-11
    • 2021-10-12
    相关资源
    最近更新 更多