flutter_multimedia_gallery 0.1.0
flutter_multimedia_gallery: ^0.1.0 copied to clipboard
Reusable Flutter carousel and full-screen gallery for image and video lists.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_multimedia_gallery/flutter_multimedia_gallery.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
final items = <GalleryItem>[
const GalleryItem(
id: 'img_1',
url:
'https://images.unsplash.com/photo-1517841905240-472988babdf9?w=1400',
type: MediaType.image,
title: 'Dog portrait',
),
const GalleryItem(
id: 'video_1',
url:
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
type: MediaType.video,
thumbnailUrl:
'https://images.unsplash.com/photo-1450778869180-41d0601e046e?w=1200',
title: 'Bee video',
),
const GalleryItem(
id: 'img_2',
url:
'https://images.unsplash.com/photo-1507146426996-ef05306b995a?w=1400',
type: MediaType.image,
title: 'Running puppy',
),
];
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Gallery Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
home: Scaffold(
appBar: AppBar(title: const Text('Multimedia Gallery')),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
MultimediaGalleryCarousel(
items: items,
height: 240,
onItemChanged: (index) {},
),
const SizedBox(height: 18),
FilledButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => MultimediaGalleryPage(items: items),
),
);
},
child: const Text('Open Fullscreen Gallery'),
),
],
),
),
);
}
}