k_gallery 1.0.1 copy "k_gallery: ^1.0.1" to clipboard
k_gallery: ^1.0.1 copied to clipboard

A Telegram-style media gallery viewer for Flutter. Supports images, videos, and audio with pinch-to-zoom, thumbnail strip, swipe-to-dismiss, and more.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:k_gallery/k_gallery.dart';
import 'gallery_demo_screen.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize the gallery engine (required for video/audio)
  KGallery.ensureInitialized();
  
  runApp(const MyApp());
}

final GoRouter _router = GoRouter(
  initialLocation: DemoGalleryScreen.path,
  routes: [
    GoRoute(
      path: DemoGalleryScreen.path,
      builder: (context, state) => const DemoGalleryScreen(),
    ),
    GoRoute(
      path: KGalleryDetailScreen.id,
      builder: (context, state) {
        final extra = state.extra as Map<String, dynamic>;
        return KGalleryDetailScreen(
          contentList: extra['contentList'] as List<GalleryItem>,
          initialIndex: extra['initialIndex'] as int,
          onIndexChanged: extra['onIndexChanged'] as void Function(int)?,
        );
      },
    ),
  ],
);

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      title: 'KGallery Telegram Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.dark,
        ),
        useMaterial3: true,
      ),
      routerConfig: _router,
    );
  }
}
1
likes
130
points
228
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Telegram-style media gallery viewer for Flutter. Supports images, videos, and audio with pinch-to-zoom, thumbnail strip, swipe-to-dismiss, and more.

Homepage
Repository (GitHub)
View/report issues

Topics

#gallery #media #image-viewer #video-player

License

MIT (license)

Dependencies

connectivity_plus, extended_image, flutter, flutter_bloc, freezed_annotation, json_annotation, media_kit, media_kit_libs_video, media_kit_video, shimmer

More

Packages that depend on k_gallery