TMDB Flutter

pub package License: MIT

A comprehensive Flutter package for integrating TMDB (The Movie Database) into your applications. This package provides ready-to-use widgets for search functionality, beautifully designed UI components for displaying movies and TV shows, and detailed metadata views.

TMDB Flutter Demo

Features

  • Rich UI Components: Modern, card-based designs with smooth animations
  • Complete TMDB API Integration: Access movies, TV shows, people, and more
  • Search Functionality: Built-in search bar with autocomplete suggestions
  • Pagination Support: Lazy loading with infinite scrolling
  • Detailed Content Views: Complete metadata display for titles
  • Season & Episode Navigation: Tab-based season browser for TV shows
  • Genre-based Browsing: Filter content by genres
  • Discovery Features: Trending, popular, and top-rated content
  • Responsive Layouts: Works on mobile, tablet, and desktop
  • Image Caching: Optimized performance with cached network images
  • Customizable Themes: Easily adapt to your app's design language

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  tmdb_flutter: ^0.1.0

Then run:

flutter pub get

Configuration

Initialize the package in your main.dart file:

import 'package:tmdb_flutter/tmdb_flutter.dart';

void main() {
  // Initialize with your TMDB API key
  TmdbFlutter.init(apiKey: 'YOUR_TMDB_API_KEY');
  
  runApp(MyApp());
}

Basic Usage

Display a Title Card

TmdbTitleCard(
  title: tmdbTitle,
  onTap: () {
    // Handle tap
  },
)
TmdbSearchBar(
  onTitleSelected: (title) {
    // Handle selected title
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => TitleDetailsPage(
          titleId: title.id,
          titleType: title.type,
        ),
      ),
    );
  },
)

Show Title Details

TmdbTitleDetailsWidget(
  titleId: 550, // Fight Club
  titleType: TmdbTitleType.movie,
  onSimilarTitleSelected: (id, type) {
    // Navigate to similar title
  },
  onCastMemberSelected: (personId) {
    // Navigate to person details
  },
)
TmdbDiscoveryWidget(
  onTitleSelected: (title) {
    // Handle title selection
  },
)

Advanced Features

Provider Integration

The package uses Provider for state management, making it easy to integrate into your application:

MultiProvider(
  providers: [
    ChangeNotifierProvider(create: (_) => SearchProvider()),
    ChangeNotifierProvider(create: (_) => TitleDetailsProvider()),
    // Add other providers as needed
  ],
  child: MaterialApp(
    // Your app
  ),
)

Customization

Most widgets support extensive customization:

TmdbTitleCard(
  title: title,
  width: 150,
  height: 225,
  borderRadius: 12.0,
  showRating: true,
  showTitle: true,
  showYear: true,
  showType: true,
  onTap: () => handleTap(title),
)

Example App

Check out the example directory for a complete sample application that demonstrates all features of the package.

API Reference

For detailed API documentation, see our API Reference.

Acknowledgments

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

tmdb_flutter