Flutter PDF Flipbook
A beautiful Flutter plugin that provides realistic book flip animations for displaying PDFs. Perfect for e-book readers, digital magazines, and any app that needs to display PDFs with engaging page-turning animations.
🌐 Live Demo
🎯 Try it here: https://flutter-pdf-flipbook.pages.dev/
🎞️ Preview
Features
- 📖 Realistic Book Flip Animation - Smooth page turning with natural book-like physics
- 🎨 Highly Customizable - Customize colors, sizes, and styling to match your app
- 📱 Responsive Design - Automatically adapts to different screen sizes
- 🔍 Zoom Support - Pinch to zoom functionality for better reading experience
- ⚡ Performance Optimized - Efficient PDF loading and caching
- 🌐 Cross-Platform Support - Works on all Flutter platforms (Android, iOS, macOS, Windows, Linux, Web)
- 📱 Multi-Device Support - Optimized for mobile phones, tablets, desktop, and web browsers
- 🎯 Easy Integration - Simple widget to add to your Flutter app
Installation
Add this to your package's pubspec.yaml file:
dependencies:
flutter_pdf_flipbook: ^<latest_version> # Check pub.dev for the latest version
Then run:
flutter pub get
Basic Usage
import 'package:flutter/material.dart';
import 'package:flutter_pdf_flipbook/flutter_pdf_flipbook.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: PdfBookViewer(
pdfUrl: 'https://example.com/your-document.pdf',
),
),
);
}
}
That's it! The plugin will load your PDF and display it with beautiful book flip animations.
Advanced Usage
Custom Styling
PdfBookViewer(
pdfUrl: 'https://example.com/document.pdf',
backgroundColor: Colors.grey.shade100,
showNavigationControls: true,
onPageChanged: (currentPage, totalPages) {
print('Page $currentPage of $totalPages');
},
onError: (String error) {
print('PDF loading error: $error');
// Handle error - show dialog, snackbar, etc.
},
style: PdfBookViewerStyle(
backgroundColor: Colors.black,
centerDividerColor: Colors.amber,
loadingIndicatorColor: Colors.blue,
centerDividerWidth: 6.0,
navigationControlsStyle: NavigationControlsStyle(
buttonColor: Colors.orange,
iconColor: Colors.white,
),
),
)
Configuration Options
PdfBookViewer Properties:
pdfUrl(required): The URL of the PDF document to displaystyle: Custom styling options (PdfBookViewerStyle)onPageChanged: Callback when page changes (currentPage, totalPages)onError: Callback when PDF loading fails (error message)showNavigationControls: Whether to show navigation controls (default: true)backgroundColor: Custom background color
PdfBookViewerStyle Properties:
backgroundColor: Main background colorbookBackgroundColor: Color behind the book pagescenterDividerColor: Color of the center line between pagescenterDividerWidth: Width of the center divider (default: 5.0)loadingIndicatorColor: Color of the loading indicatorbookContainerDecoration: Custom decoration for the book containernavigationControlsStyle: Styling for navigation controls
NavigationControlsStyle Properties:
buttonColor: Color of navigation buttons (default: Colors.grey)iconColor: Color of navigation icons (default: Colors.white)shadow: Custom shadow for the navigation bar
Example App
See the example/ directory for a complete example app demonstrating all features.
Controls
- Swipe Left/Right: Navigate between pages
- Pinch to Zoom: Zoom in for detailed reading
- Navigation Controls: Use the bottom navigation bar
- Previous/Next arrows to navigate
- Page input field to jump to specific pages
- Search button to go to entered page
Performance Tips
- Network PDFs: The plugin automatically handles caching for better performance
- Large PDFs: Pages are loaded progressively as needed
- Memory Management: Closed pages are automatically cleaned up
Requirements
- Flutter >=3.0.0
- Dart >=3.0.0
Platform Support
Operating Systems
✅ Android - Fully supported with native PDF rendering
✅ iOS - Fully supported with native PDF rendering
✅ macOS - Fully supported with native PDF rendering
✅ Windows - Fully supported with native PDF rendering
✅ Linux - Fully supported with native PDF rendering
✅ Web - Fully supported with web-based PDF rendering
Device Types
📱 Mobile Phones - Optimized touch interactions and responsive design 📱 Tablets - Enhanced for larger screens with improved navigation 💻 Desktop - Full mouse and keyboard support with precise controls 🌐 Web Browsers - Cross-browser compatibility with web-based PDF rendering
All platforms and devices support:
- PDF loading from URLs and local assets
- Background colors
- Custom styling and theming
- Book flip animations
- Zoom functionality
- Navigation controls
- Error handling
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.
Made with ❤️ for Flutter developers