Skip to content

burhankhanzada/interactive_viewer_plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive Viewer Plus

Pub Version Pub Downloads License

A powerful extension of Flutter's InteractiveViewer with advanced programmatic controls. It adds support for rotation, flipping, and precise panning, all manageable via an enhanced controller.

Preview

Features

Interactive Viewer Plus brings the InteractiveViewer to the next level with:

  • 🔄 Programmatic Rotation: Effortlessly rotate your content by any angle.
  • ↔️ Flipping Support: Easily flip your content horizontally (X-axis) or vertically (Y-axis).
  • 🎯 Precise Panning: Move the viewport to specific offsets programmatically.
  • 🎮 Enhanced Controller: InteractiveViewerPlusController provides more methods than the standard TransformationController.
  • ⌨️ Keyboard Shortcut Ready: Built with external triggers in mind, perfect for desktop or tool-heavy apps.
  • 🚀 Drop-in Replacement: Works just like the standard widget but with extra "plus" features.

Getting started

Add the dependency to your pubspec.yaml:

dependencies:
  interactive_viewer_plus: ^0.0.4

Usage

Using InteractiveViewerPlus is straightforward. Just replace your InteractiveViewer and use the InteractiveViewerPlusController for advanced control.

import 'package:interactive_viewer_plus/interactive_viewer_plus.dart';

// 1. Initialize the controller
final controller = InteractiveViewerPlusController();

// 2. Use the widget
InteractiveViewerPlus(
  controller: controller,
  minScale: 0.1,
  maxScale: 5.0,
  child: Image.network('https://example.com/large-image.jpg'),
)

// 3. Control it programmatically
controller.zoom(1.2);          // Zoom in 20%
controller.rotate(math.pi / 4); // Rotate 45 degrees
controller.flip(flipX: true);   // Flip horizontally
controller.pan(Offset(10, 0));  // Pan 10 pixels right

Full Programmatic Control

Method Description
zoom(double factor) Scales the view relative to the current scale.
rotate(double radians) Rotates the view by the given amount.
flip({bool flipX, bool flipY}) Flips the view on the specified axes.
pan(Offset offset) Translates the view by the given offset.

My other packages

Contributors

About

Improvements on default Flutter InteractiveViewer widget

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors