flutter_multimedia_gallery

flutter_multimedia_gallery is a reusable Flutter package that renders a mixed media list (images and videos) as:

  • an embeddable carousel widget for any screen
  • an optional full-screen gallery page on tap
  • built-in page indicators and optional thumbnail strip

Features

  • Accept a single list of GalleryItem objects
  • Supports image and video media types
  • Full-screen gallery page with swipe navigation
  • Built with cached_network_image, video_player, video_thumbnail
  • Simple API with constructor arguments (no GetX dependency)

Installation

Add to pubspec.yaml:

dependencies:
  flutter_multimedia_gallery: ^0.1.0

Usage

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

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

  @override
  Widget build(BuildContext context) {
    final items = <GalleryItem>[
      const GalleryItem(
        url: 'https://images.unsplash.com/photo-1517841905240-472988babdf9?w=1200',
        type: MediaType.image,
        title: 'Dog portrait',
      ),
      const GalleryItem(
        url: 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
        type: MediaType.video,
        title: 'Bee video',
      ),
    ];

    return Scaffold(
      appBar: AppBar(title: const Text('Media')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: MultimediaGalleryCarousel(items: items),
      ),
    );
  }
}

Open full-screen manually

Navigator.of(context).push(
  MaterialPageRoute(
    builder: (_) => MultimediaGalleryPage(items: items, initialIndex: 0),
  ),
);

Data model

GalleryItem(
  url: 'https://example.com/media.jpg',
  type: MediaType.image, // or MediaType.video
  thumbnailUrl: 'https://example.com/thumb.jpg', // optional
  title: 'Optional title',
  id: 'optional-id',
)

Notes

  • Pass absolute URLs or file paths in GalleryItem.url.
  • For video entries, thumbnailUrl improves thumbnail loading speed.
  • Replace GitHub metadata in pubspec.yaml with your repository URLs before publish.