pinch_zoom 2.0.1 copy "pinch_zoom: ^2.0.1" to clipboard
pinch_zoom: ^2.0.1 copied to clipboard

A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PinchZoom demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const ExamplePage(),
    );
  }
}

class ExamplePage extends StatelessWidget {
  const ExamplePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('PinchZoom Page'),
      ),
      body: Column(
        children: [
          PinchZoom(
            maxScale: 2.5,
            onZoomStart: () {
              print('Start zooming cat');
            },
            onZoomEnd: () {
              print('Stop zooming cat');
            },
            child: Image.network('https://placecats.com/640/360'),
          ),
          PinchZoom(
            maxScale: 2.5,
            onZoomStart: () {
              print('Start zooming dog');
            },
            onZoomEnd: () {
              print('Stop zooming dog');
            },
            child: Image.network('https://placedog.net/640/360'),
          ),
        ],
      ),
    );
  }
}
211
likes
160
points
9.87k
downloads

Publisher

verified publisherjelter.net

Weekly Downloads

A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released.

Homepage
Repository (GitHub)

Documentation

API reference

License

ISC (license)

Dependencies

flutter

More

Packages that depend on pinch_zoom