photo_opener 0.2.9
photo_opener: ^0.2.9 copied to clipboard
Telegram-style full-screen image viewer for Flutter. Pinch to zoom, swipe between images, thumbnails, swipe-down to dismiss. Supports network, assets, and local files.
πΈ Photo Opener #
A Flutter package for a Telegram-style full-screen image viewer. Open images with smooth pinch-to-zoom, swipe navigation, thumbnails, and swipe-down-to-dismissβready to use with a single function call.
Supports: network URLs β’ local assets β’ device files β’ web (assets & network only)
β¨ Features #
- πΌ Full-screen viewer β Immersive image viewing
- π Pinch to zoom β Smooth gestures with configurable min/max scale
- π Gallery mode β Swipe between multiple images
- π Swipe down to dismiss β Natural closing gesture (when not zoomed)
- π± Tap to toggle UI β Show/hide header, footer, and thumbnails
- π¨ Customizable β Colors, padding, close button, loader, error widget
- π± Platform support β Android, iOS, Web, Windows, macOS, Linux
π· Preview #

Run the example app to see the viewer in action.
π Installation #
Add to your pubspec.yaml:
dependencies:
photo_opener: ^0.2.8
Or use:
flutter pub add photo_opener
π Quick Start #
Minimal exampleβopen a gallery with one line:
import 'package:flutter/material.dart';
import 'package:photo_opener/photo_opener.dart';
// Inside your widget (e.g. onTap of an image):
onOpenPhoto(
context: context,
images: [
'https://picsum.photos/id/1/1024/768',
'https://picsum.photos/id/2/1024/768',
],
type: PhotoType.network,
);
π Full Example (Assets) #
import 'package:flutter/material.dart';
import 'package:photo_opener/photo_opener.dart';
onOpenPhoto(
context: context,
images: [
'assets/images/photo1.png',
'assets/images/photo2.png',
'assets/images/photo3.png',
],
type: PhotoType.asset,
initialIndex: 1,
closeText: 'Back',
minScale: 1,
maxScale: 5,
);
π Authorization (JWT / Bearer Token) #
Pass headers for authenticated image URLs:
onOpenPhoto(
context: context,
images: imageUrls,
type: PhotoType.network,
httpHeaders: {
'Authorization': 'Bearer your_token_here',
},
);
β οΈ Error Handling #
Show a custom widget when image loading fails (e.g. in thumbnails):
onOpenPhoto(
context: context,
images: imageUrls,
type: PhotoType.network,
errorWidget: (context, url, error) => Icon(
Icons.broken_image,
size: 32,
color: Colors.white70,
),
);
π± Platform Notes #
| Platform | Network | Assets | Local Files |
|---|---|---|---|
| Android | β | β | β |
| iOS | β | β | β |
| Web | β | β | β |
| Desktop | β | β | β |
Web: Use PhotoType.network or PhotoType.asset. PhotoType.file is not supported on web.
π License #
MIT License β use freely in your projects.