패키지, 저장소 및 앱 카테고리 검색

cosmos_epub 표지
패키지 상세v1.0.1

cosmos_epub

페이지 전환 애니메이션, 텍스트 강조, 하이픈 처리, 무한 중첩 챕터, 이미지 지원, RTL 언어, 사용자 정의 테마 및 글꼴을 갖춘 기능이 풍부한 Flutter용 EPUB 리더 패키지입니다.

AndroidiOS
30일 다운로드
116
좋아요
46
Pub 점수
70

패키지 설치

flutter pub add cosmos_epub

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Cosmos EPUB은 부드러운 페이지 전환 애니메이션, 텍스트 강조, 하이픈화, 무한 중첩 챕터를 지원하는 기능이 풍부한 플러터 패키지입니다. 이미지 및 오른쪽에서 왼쪽으로 읽는 언어를 처리하며 사용자 정의 테마와 폰트를 제공합니다. 고급 형식과 접근성 기능을 갖춘 몰입형 독서 앱 개발에 적합합니다.

사용 사례

  • EPUB 형식의 디지털 책 읽기
  • 전자 독서기 애플리케이션 구축
  • 다국어 및 RTL 텍스트 지원
  • 상호작용형 교육 콘텐츠 만들기
  • 텍스트 강조 및 주석 활성화

주요 기능

  • 페이지 플립 애니메이션
  • 텍스트 강조 및 하이픈화
  • 무한히 중첩된 챕터 구조
  • 이미지 및 RTL 언어 지원
  • 사용자 지정 테마 및 글꼴

적합한 대상

  • 전자책 리더
  • 교육 앱
  • 다국어 콘텐츠 플랫폼
  • 접근성 중심 애플리케이션
  • 사용자 정의 가능한 독서 경험

고려 사항

  • 큰 EPUB 파일을 주의 깊게 처리해야 합니다
  • 저사양 기기용 최적화가 필요할 수 있습니다
  • EPUB 형식만 지원
  • 테마 사용자 정의는 UI 지식이 필요합니다
  • 업데이트를 위해 외부 GitHub 저장소에 의존합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

CosmosEpub 💫

A feature-rich EPUB reader package for Flutter with page flip animations, text highlighting, hyphenation, infinite nested chapters, image support, RTL languages, customizable themes and fonts.

Showcase

banner

Features

  • Text Highlighting — select text, pick a color (6 options), highlights persist across sessions. Re-highlight to change color. Copy & Select All support.
  • Hyphenation — syllable-aware word breaking for better justified text. Visible "-" at line breaks. Respects Uzbek digraphs (ch, sh, g', o').
  • Infinite Nested Chapters — recursive TOC with unlimited depth. Section title pages auto-generated.
  • Image Support — EPUB images rendered inline (PNG, JPEG, GIF, SVG, WebP).
  • Page Flip Animation — realistic 3D page curl effect with swipe gestures.
  • 5 Themes — Grey, Purple, White, Black, Pink.
  • 14 Fonts — Alegreya, Amazon Ember, Bookerly, EB Garamond, Lora, Ubuntu, and more.
  • RTL Support — Arabic, Persian, Hebrew, Urdu, and other RTL languages with auto-detection.
  • Reading Progress — chapter and page position saved per book.
  • Brightness Control — in-reader brightness slider.
  • Multiple Sources — open EPUB from assets, local file, URL, or raw bytes.
  • Robust Parsing — 3-tier chapter resolution (NCX NavMap → epubx Chapters → Spine order). Handles malformed EPUBs.

Getting Started

Add the dependency:

dependencies:
  cosmos_epub: ^1.0.0
flutter pub get

Usage

Initialize

Call initialize() once before using any other method (preferably in main.dart):

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await CosmosEpub.initialize();
  runApp(MyApp());
}
Open a Book
// From assets
await CosmosEpub.openAssetBook(
  assetPath: 'assets/book.epub',
  context: context,
  bookId: 'my_book_1',
  accentColor: Colors.indigoAccent,
  onPageFlip: (currentPage, totalPages) {
    print('Page $currentPage of $totalPages');
  },
  onLastPage: (lastPageIndex) {
    print('Reached last page');
  },
);

// From local file
await CosmosEpub.openLocalBook(
  localPath: '/path/to/book.epub',
  context: context,
  bookId: 'my_book_2',
);

// From URL
await CosmosEpub.openURLBook(
  urlPath: 'https://example.com/book.epub',
  context: context,
  bookId: 'my_book_3',
);

// From bytes
await CosmosEpub.openFileBook(
  bytes: myUint8List,
  context: context,
  bookId: 'my_book_4',
);
Progress Management
// Get current progress
BookProgressModel progress = CosmosEpub.getBookProgress('my_book_1');
print('Chapter: ${progress.currentChapterIndex}');
print('Page: ${progress.currentPageIndex}');

// Set progress manually
await CosmosEpub.setCurrentChapterIndex('my_book_1', 5);
await CosmosEpub.setCurrentPageIndex('my_book_1', 3);

// Delete progress
await CosmosEpub.deleteBookProgress('my_book_1');
await CosmosEpub.deleteAllBooksProgress();
Highlight Management
// Get all highlights for a book
List<HighlightModel> highlights = CosmosEpub.getBookHighlights('my_book_1');

// Remove a specific highlight
CosmosEpub.removeHighlight(highlights.first.id);

// Remove all highlights for a book
CosmosEpub.removeAllHighlights('my_book_1');
Clear Theme Cache
await CosmosEpub.clearThemeCache();

Parameters

Parameter Type Default Description
assetPath / localPath / urlPath / bytes String / Uint8List required EPUB source
context BuildContext required Build context for navigation
bookId String required Unique ID for progress tracking
accentColor Color Colors.indigoAccent Primary accent color
onPageFlip Function(int, int)? null Called on page change
onLastPage Function(int)? null Called on last page
chapterListTitle String 'Table of Contents' TOC screen title
shouldOpenDrawer bool false Open TOC on start
starterChapter int -1 Start at specific chapter

RTL Language Support 🌍

Automatic detection and support for Right-to-Left languages:

  • Arabic (العربية), Persian (فارسی), Hebrew (עברית), Urdu (اردو)
  • Pashto (پښتو), Sindhi (سنڌي), Kurdish (کوردی), Dhivehi (ދިވެހި), Yiddish (ייִדיש)

No configuration needed — just open the EPUB and the library handles direction, alignment, and navigation automatically.

Notes

  • Each book must have a unique bookId. Using the same ID for different books will cause progress conflicts.
  • Highlights are stored locally via GetStorage and persist across app restarts.
  • The package uses isar_community for progress persistence (Android/iOS/Desktop only, no web support).

License

BSD-3

Contact

Feel free to open an issue or reach out: https://allmylinks.com/mamasodikov

카테고리

의존성

의존성 목록 12 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.