zeba_books_epub_viewer 0.0.1 copy "zeba_books_epub_viewer: ^0.0.1" to clipboard
zeba_books_epub_viewer: ^0.0.1 copied to clipboard

High-performance EPUB renderer with Creative Commons integration.

Zeba Books EPUB Viewer #

High-performance EPUB renderer with annotation support, CC metadata extraction, and customizable themes for Flutter.


Features #

  • Load EPUBs from assets, files, or bytes.
  • Chapter pagination with automatic page splitting.
  • Annotations & bookmarks per chapter and page.
  • Customizable themes: classic, dark, and light.
  • Supports NCX TOC for navigation.
  • CC metadata extraction for Creative Commons licensing.

Installation #

Add the dependency in your pubspec.yaml:

dependencies:
  zeba_books_epub_viewer:
    git:
      url: https://github.com/yourusername/zeba_books_epub_viewer.git
      ref: main

Run:

flutter pub get

Usage #

Basic Example #

import 'package:flutter/material.dart';
import 'package:zeba_books_epub_viewer/zeba_books_epub_viewer.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const EpubExample(),
    );
  }
}

class EpubExample extends StatefulWidget {
  const EpubExample({super.key});

  @override
  State<EpubExample> createState() => _EpubExampleState();
}

class _EpubExampleState extends State<EpubExample> {
  final parser = EpubParser();

  @override
  void initState() {
    super.initState();
    parser.loadEpubAsset('test_assets/sample.epub');
  }

  @override
  Widget build(BuildContext context) {
    return EpubView(
      parser: parser,
      bookId: 'sample_book',
      fontSize: 18,
      theme: EpubTheme.classic,
    );
  }
}

Loading EPUB #

From Asset #

await parser.loadEpubAsset('assets/sample.epub');

From File #

await parser.loadEpubFile('/path/to/book.epub');

From Bytes #

await parser.loadEpubBytes(epubBytes);

Annotations #

await AnnotationDB.addAnnotation(
  Annotation(
    bookId: 'sample_book',
    chapter: 0,
    page: 0,
    note: 'My note',
  ),
);

Themes #

  • EpubTheme.classic (default)
  • EpubTheme.dark
  • EpubTheme.light

Example:

EpubView(
  parser: parser,
  bookId: 'sample_book',
  theme: EpubTheme.dark,
);

Pagination #

The viewer automatically paginates chapters based on:

  • fontSize
  • lineHeight
  • Device screen width & height

Use _nextChapter() and _prevChapter() to navigate manually.


License #

This package is available under the MIT License.


Contributing #

  1. Fork the repository.
  2. Make changes in a new branch.
  3. Run flutter test to ensure all tests pass.
  4. Open a pull request.

0
likes
130
points
78
downloads

Publisher

verified publisherzeba.academy

Weekly Downloads

High-performance EPUB renderer with Creative Commons integration.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

archive, epubx, flutter, path, path_provider, provider, sqflite

More

Packages that depend on zeba_books_epub_viewer