[go: up one dir, main page]

photo_opener 0.2.3 copy "photo_opener: ^0.2.3" to clipboard
photo_opener: ^0.2.3 copied to clipboard

A Flutter package to preview and zoom images just like Telegram's media viewer. Supports assets and network images with pinch-to-zoom, swipe navigation, and smooth animations.

📸 Photo Opener #

A Flutter package to open and zoom images with smooth gestures and customizable UI. Perfect for displaying images in full-screen mode with pinch-to-zoom functionality.

✨ Features #

🖼 Open images in a full-screen viewer

🔍 Zoom in/out with smooth pinch gestures

🌈 Customizable colors, paddings, and styles

📜 Support for multiple images with swipe

🌐 Works with local assets or network images

📷 Preview #

Demo

📖 Usage #

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photo_opener/photo_opener.dart';

class PhotoOpenerExample extends StatefulWidget {
  const PhotoOpenerExample({super.key});

  @override
  State<PhotoOpenerExample> createState() => _PhotoOpenerExampleState();
}

class _PhotoOpenerExampleState extends State<PhotoOpenerExample> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Example Photo Opener"),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          GestureDetector(
            onTap: () {
              PageController pageController = PageController();
              onOpenPhoto(
                context: context,
                closeText: "Back",
                secondaryColor: Colors.black,
                backgroundColor: Colors.black,
                pageController: pageController,
                onPageChange: (newPage) {},
                minScale: 1,
                maxScale: 5,
                loaderColor: Colors.red,
                leftPadding: 20,
                isNetwork: false,
                initialIndex: 2,
                topTextStyle: const TextStyle(
                  color: CupertinoColors.white,
                  fontWeight: FontWeight.w600,
                ),
                images: [
                  "assets/images/example_1.png",
                  "assets/images/example_2.png",
                  "assets/images/example_3.png",
                ],
              );
            },
            child: Center(
              child: ClipRRect(
                borderRadius: BorderRadius.circular(24),
                child: Image.asset(
                  "assets/images/example_1.png",
                  width: 300,
                  height: 300,
                  fit: BoxFit.cover,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

📜 License #

This package is licensed under the MIT License. Feel free to use it in your projects.

12
likes
150
points
91
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to preview and zoom images just like Telegram's media viewer. Supports assets and network images with pinch-to-zoom, swipe navigation, and smooth animations.

Repository (GitHub)
View/report issues

Topics

#image #gallery #viewer #zoom #photos

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

cached_network_image, flutter, photo_view

More

Packages that depend on photo_opener