epub_kitty 0.1.0 epub_kitty: ^0.1.0 copied to clipboard
epub_kitty is an epub ebook reader that encapsulates the folioreader framework. It supports iOS and android, but is customizable on iOS. It is very easy to use, you just need to set up the configurati [...]
import 'dart:io';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:epub_kitty/epub_kitty.dart';
import 'package:path_provider/path_provider.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
static const pageChannel = const EventChannel('com.xiaofwang.epub_kitty/page');
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: GestureDetector(
onTap: () async {
Directory appDocDir = await getTemporaryDirectory();
print(appDocDir.path);
String iosBookPath = '${appDocDir.path}/3.epub';
String androidBookPath = 'file:///android_asset/PhysicsSyllabus.epub';
EpubKitty.setConfig("iosBook", "#32a852","vertical",true);
EpubKitty.open(androidBookPath);
pageChannel.receiveBroadcastStream().listen((Object event) {
print('page:$event');
}, onError: null);
},
child: Container(
child: Text('open epub'),
),
),
),
),
);
}
}