Skip to content

Commit

Permalink
Added [epub_view] package
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeShkurko committed Dec 9, 2019
1 parent 851faea commit 5a2b2d0
Show file tree
Hide file tree
Showing 75 changed files with 1,849 additions and 76 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
|---|---|
| [![pub package][native_pdf_renderer_badge]][native_pdf_renderer_pub] | [`packages/native_pdf_renderer`][native_pdf_renderer_code] |
| [![pub package][native_pdf_view_badge]][native_pdf_view_pub] | [`packages/native_pdf_view`][native_pdf_view_code] |
| [![pub package][epub_view_badge]][epub_view_pub] | [`packages/epub_view`][epub_view_code] |
| [![pub package][native_color_badge]][native_color_pub] | [`packages/native_color`][native_color_code] |
| [![pub package][auto_animated_badge]][auto_animated_pub] | [`packages/auto_animated`][auto_animated_code] |


[native_pdf_renderer_pub]: https://pub.dartlang.org/packages/native_pdf_renderer
[native_pdf_renderer_code]: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/native_pdf_renderer
[native_pdf_renderer_code]: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/native_pdf_renderer
[native_pdf_renderer_badge]: https://img.shields.io/pub/v/native_pdf_renderer.svg

[native_pdf_view_pub]: https://pub.dartlang.org/packages/native_pdf_view
[native_pdf_view_code]: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/native_pdf_view
[native_pdf_view_code]: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/native_pdf_view
[native_pdf_view_badge]: https://img.shields.io/pub/v/native_pdf_view.svg

[epub_view_pub]: https://pub.dartlang.org/packages/epub_view
[epub_view_code]: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/epub_view
[epub_view_badge]: https://img.shields.io/pub/v/epub_view.svg

[native_color_pub]: https://pub.dartlang.org/packages/native_color
[native_color_code]: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/native_color
[native_color_code]: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/native_color
[native_color_badge]: https://img.shields.io/pub/v/native_color.svg

[auto_animated_pub]: https://pub.dartlang.org/packages/auto_animated
[auto_animated_code]: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/auto_animated
[auto_animated_code]: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/auto_animated
[auto_animated_badge]: https://img.shields.io/pub/v/auto_animated.svg
8 changes: 4 additions & 4 deletions packages/auto_animated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Already added:

## Screenshots
<p float="left">
<img src='https://github.com/rbcprolabs/flutter_plugins/raw/master/packages/auto_animated/example/media/horizontal.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/flutter_plugins/raw/master/packages/auto_animated/example/media/vertical.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/flutter_plugins/raw/master/packages/auto_animated/example/media/combined.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/flutter_plugins/raw/master/packages/auto_animated/example/media/icon_button.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/packages.flutter/raw/master/packages/auto_animated/example/media/horizontal.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/packages.flutter/raw/master/packages/auto_animated/example/media/vertical.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/packages.flutter/raw/master/packages/auto_animated/example/media/combined.gif' width="20%" hspace="1%">
<img src='https://github.com/rbcprolabs/packages.flutter/raw/master/packages/auto_animated/example/media/icon_button.gif' width="20%" hspace="1%">
</p>

## Getting Started
Expand Down
16 changes: 8 additions & 8 deletions packages/auto_animated/example/lib/screens/icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class _AutoAnimatedIconButtonExampleState
padding: EdgeInsets.all(16),
child: AppBar(
primary: false,
title: Text('Auto animated Icon'),
// Implement animated icon
leading: AutoAnimatedIconButton(
icon: AnimatedIcons.menu_close,
firstToolip: 'Menu',
secondToolip: 'Close',
onPressed: () {},
title: Text('Auto animated Icon'),
// Implement animated icon
leading: AutoAnimatedIconButton(
icon: AnimatedIcons.menu_close,
firstToolip: 'Menu',
secondToolip: 'Close',
onPressed: () {},
),
),
),
),
AutoAnimatedIconButton.externalState(
icon: AnimatedIcons.arrow_menu,
onPressed: () {
Expand Down
1 change: 1 addition & 0 deletions packages/auto_animated/lib/src/sliver_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class _AutoAnimatedSliverListState extends State<AutoAnimatedSliverList>
init(from: itemsCount);
}
}

@override
void dispose() {
_timer?.cancel();
Expand Down
2 changes: 1 addition & 1 deletion packages/auto_animated/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: auto_animated
description: Widgets starting auto play animation when mounted. It is already possible to animate the list and icons.
version: 1.3.0-dev.5
author: Serge Shkurko <[email protected]>
homepage: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/auto_animated
homepage: https://github.com/rbcprolabs/packages.flutter/tree/master/packages/auto_animated

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down
73 changes: 73 additions & 0 deletions packages/epub_view/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions packages/epub_view/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 68587a0916366e9512a78df22c44163d041dd5f3
channel: stable

project_type: package
3 changes: 3 additions & 0 deletions packages/epub_view/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

* Initial release
21 changes: 21 additions & 0 deletions packages/epub_view/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 RBC, Serge Shkurko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions packages/epub_view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# flutter_epub

Flutter widget for view EPUB documents on all platforms. Based on [epub](https://pub.dev/packages/epub) package.

## Usage example:
```dart
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_epub/flutter_epub.dart';
import 'package:flutter/services.dart' show rootBundle;
Future<Uint8List> _loadFromAssets(String assetName) async {
final bytes = await rootBundle.load(assetName);
return bytes.buffer.asUint8List();
}
@override
Widget build(BuildContext context) => Scaffold(
body: FutureBuilder<EpubBook>(
future: _loadFromAssets('assets/book.epub').then(EpubReader.readBook),
builder: (_, snapshot) {
if (snapshot.hasData) {
return EpubReaderView(
book: snapshot.data,
// Called when scrolled to another chapter
headerBuilder: (value) => AppBar(
title: Text(
'Chapter ${value?.chapter?.Title ?? 'Loading...'}',
),
),
// Start from special chapter
startFrom: EpubReaderLastPosition(3),
);
}
return Center(
child: CircularProgressIndicator(),
);
},
),
);
```

## How start from last view position?
This method allows you to keep the exact reading position even inside the chapter:
```dart
EpubReaderView(
...,
// At first add on change callback
onChange: (value) {
// next get last position for save
final lastPositionString = value.asLastPosition.toString();
// save last position string anywhere
}
);
// next step usage last position string:
EpubReaderView(
startFrom: EpubReaderLastPosition.fromString(lastPositionString),
);
```

## Getting Started

This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
1 change: 1 addition & 0 deletions packages/epub_view/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: ../../analysis_options.yaml
73 changes: 73 additions & 0 deletions packages/epub_view/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
/build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions packages/epub_view/example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 68587a0916366e9512a78df22c44163d041dd5f3
channel: stable

project_type: app
16 changes: 16 additions & 0 deletions packages/epub_view/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# epub_view_example

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Loading

0 comments on commit 5a2b2d0

Please sign in to comment.