Katbook EPUB Reader

GitHub pub package License: MIT

A powerful, customizable EPUB reader widget for Flutter with proper hierarchical chapter support, theme customization, reading progress tracking, and robust image handling.

Features

  • 📚 Full EPUB Support - Proper parsing of EPUB 2 and EPUB 3 formats
  • 📖 Hierarchical Table of Contents - Support for nested chapters at any depth
  • 🎨 Built-in Themes - Light, Sepia, and Dark themes out of the box
  • 🔤 Customizable Typography - Adjustable font size with slider control
  • 📍 Reading Progress - Precise position tracking and percentage progress
  • 💾 Position Save/Restore - Resume reading from where you left off
  • 🖼️ Image Handling - Robust extraction and display of embedded images
  • 📐 Responsive Layout - Configurable content width (percentage-based)
  • 🎯 CSS Support - Parses EPUB stylesheets for proper text alignment and styling
  • 📄 Front Matter Support - Displays cover, dedication, and other pre-chapter content

Installation

Add katbook_epub_reader to your pubspec.yaml:

dependencies:
  katbook_epub_reader: ^1.0.0

Or run this command in your terminal:

flutter pub add katbook_epub_reader

Then import it in your Dart code:

import 'package:katbook_epub_reader/katbook_epub_reader.dart';

Dependencies

  • epubx ^4.0.0 - EPUB parsing
  • html ^0.15.6 - HTML DOM parsing
  • scrollable_positioned_list ^0.3.8 - Efficient list scrolling
  • collection ^1.19.1 - Collection utilities

Example App

See the example/ directory for a complete, runnable example application.

Comparison with epub_view

Feature katbook_epub_reader epub_view
Hierarchical TOC ✅ Any depth ❌ Flat only
CSS Parsing ✅ Full support ❌ Limited
Front Matter ✅ Supported ❌ No
Theme System ✅ 3 built-in ✅ Basic
Font Size Slider ✅ Built-in ❌ Manual
Position Save/Restore ✅ Full ⚠️ Limited
Content Width Control ✅ Percentage-based ❌ No
Image Handling ✅ Robust ⚠️ Basic

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to the repository.