pinch_zoom 0.1.0-nullsafety.0 pinch_zoom: ^0.1.0-nullsafety.0 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.
import 'package:flutter/material.dart';
import 'package:pinch_zoom/pinch_zoom.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'PinchZoom demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: ExamplePage(),
);
}
}
class ExamplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('PinchZoom Page'),
),
body: PinchZoom(
image: Image.network('https://placekitten.com/640/360'),
zoomedBackgroundColor: Colors.black.withOpacity(0.5),
resetDuration: const Duration(milliseconds: 100),
maxScale: 2.5,
onZoomStart: (){print('Start zooming');},
onZoomEnd: (){print('Stop zooming');},
),
);
}
}