eng-sayed / fereader

A Flutter epub reader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fereader pub package

Inspired by epub_viewer I made this to fit my needs.

Install

This plugin requires Swift to work on iOS. Also, the minimum deployment target is 9.0

platform :ios, '9.0'

Import into pubspec.yaml

dependencies:
  fereader: 0.0.1

Note: Please add this to the release build type in your app build.gradle to avoid crashes on android release builds

minifyEnabled false
shrinkResources false

Usage

Fereader.setConfig(
  themeColor: Theme.of(context).primaryColor,
  identifier: "iosBook",
  scrollDirection: EpubScrollDirection.VERTICAL,
  allowSharing: true,
  enableTts: true,
)

/**
* @bookPath
* @lastLocation (optional and only android)
*/
Fereader.open(
  '/path/to/ebook.epub',
  lastLocation: EpubLocator.fromJson({
    "bookId": "2239",
    "href": "/OEBPS/ch06.xhtml",
    "created": 1539934158390,
    "locations": {
       "cfi": "epubcfi(/0!/4/4[simple_book]/2/2/6)"
    }
  }), // first page will open up if the value is null
);

// Get locator which you can save in your database
EpubViewer.locatorStream.listen((locator) {
   print('LOCATOR: ${EpubLocator.fromJson(jsonDecode(locator))}');
   // convert locator from string to json and save to your database to be retrieved later
});

About

A Flutter epub reader

License:Apache License 2.0


Languages

Language:Swift 31.1%Language:Java 24.9%Language:Dart 24.0%Language:Kotlin 11.6%Language:Ruby 6.5%Language:Objective-C 1.9%