{"id":32295062,"url":"https://github.com/mamasodikov/cosmos_epub","last_synced_at":"2025-10-23T03:51:20.300Z","repository":{"id":239210105,"uuid":"798883466","full_name":"Mamasodikov/cosmos_epub","owner":"Mamasodikov","description":"EPUB reader package with great UI, easy customization and awesome features","archived":false,"fork":false,"pushed_at":"2025-09-08T10:20:00.000Z","size":8743,"stargazers_count":19,"open_issues_count":11,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T12:23:49.033Z","etag":null,"topics":["dart","epub","epubreader","flutter","package","reader"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/cosmos_epub","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mamasodikov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-10T17:13:46.000Z","updated_at":"2025-09-08T10:20:06.000Z","dependencies_parsed_at":"2024-06-23T07:05:14.565Z","dependency_job_id":null,"html_url":"https://github.com/Mamasodikov/cosmos_epub","commit_stats":null,"previous_names":["mamasodikov/cosmos_epub"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mamasodikov/cosmos_epub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mamasodikov%2Fcosmos_epub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mamasodikov%2Fcosmos_epub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mamasodikov%2Fcosmos_epub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mamasodikov%2Fcosmos_epub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mamasodikov","download_url":"https://codeload.github.com/Mamasodikov/cosmos_epub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mamasodikov%2Fcosmos_epub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280557084,"owners_count":26350569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","epub","epubreader","flutter","package","reader"],"created_at":"2025-10-23T03:51:12.170Z","updated_at":"2025-10-23T03:51:20.295Z","avatar_url":"https://github.com/Mamasodikov.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CosmosEpub 💫\n\n**CosmosEpub** is a Flutter package that allows users to open and read **EPUB** files easily. It provides features like opening **EPUB** files from ***assets*** or ***local path***, changing themes, adjusting font styles and sizes, accessing chapter contents, and more.\nThe reader is **responsive**, enabling its use with both normal-sized smartphones and tablets.\n\n## Showcase\n\n![banner](https://github.com/Mamasodikov/cosmos_epub/assets/64262986/b3ca850b-96da-48fc-9b9e-ff5f92544f53)\n\n## Features\n\n\n- Open EPUB files from assets or local path.\n- **RTL (Right-to-Left) language support** for Arabic, Persian, Hebrew, Urdu, and other RTL languages\n- **Automatic text direction detection** with proper alignment and navigation\n- Change themes with 5 options: Grey, Purple, White, Black, and Pink\n- Customize font style and size\n- Access table of contents and navigate to specific chapters\n- Display current chapter name at the bottom of the screen\n- Previous and next buttons to switch between chapters (RTL-aware)\n- Adjust screen brightness\n- Save book reading progress\n- Nice page flip animation while reading\n- **Mixed content support** (LTR + RTL text in the same document)\n- ...and feel free to ask for new features @ generalmarshallinbox@gmail.com or open an issue.\n\n## Getting Started #\n\nIn your flutter project add the dependency:\n\n   ```yaml\n   dependencies:\n     cosmos_epub: ^x.y.z\n   ```  \n\nRun the command:\n\n   ```yaml\n   flutter pub get\n   ```    \nFor more information, check out the [documentation](https://flutter.dev/).\n\n## Usage example\nImport the package in your Dart code:\n\n   ```yaml\n   import 'package:cosmos_epub/cosmos_epub.dart';\n   ```  \nFirst things first, you have to `initialize` databases before using any other method. Kindly, do it earlier, preferably in the main.dart file.\n\nThere are various methods to control over book progress DB too for your ease :)\n\n```dart\nvoid main() async {\n  WidgetsFlutterBinding.ensureInitialized();\n\n  // Initializer and methods return a bool\n  var _initialized = await CosmosEpub.initialize();\n  \n  if (_initialized) {\n    BookProgressModel bookProgress = CosmosEpub.getBookProgress('bookId');\n    await CosmosEpub.setCurrentPageIndex('bookId', 1);\n    await CosmosEpub.setCurrentChapterIndex('bookId', 2);\n    await CosmosEpub.deleteBookProgress('bookId');\n    await CosmosEpub.deleteAllBooksProgress();\n  }\n\n  runApp(MyApp());\n}\n```\n\nTo open an EPUB file from the assets, use the `openAssetBook` method:\n\n   ```dart\n    await CosmosEpub.openAssetBook(\n        assetPath: 'assets/book.epub',\n        context: context,\n        // Book ID is required to save the progress for each opened book\n        bookId: '3',\n        // Callbacks are optional\n        onPageFlip: (int currentPage, int totalPages) {\n          print(currentPage);\n        },\n        onLastPage: (int lastPageIndex) {\n          print('We arrived to the last widget');\n        });\n   ```  \nTo open an EPUB file from a local storage, use the `openLocalBook` method:\n\n   ```dart\n    await CosmosEpub.openLocalBook(\n        localPath: book.path,\n        context: context,\n        // Book ID is required to save the progress for each opened book\n        bookId: '3'\n        // Callbacks are optional\n        onPageFlip: (int currentPage, int totalPages) {\n          print(currentPage);\n        },\n        onLastPage: (int lastPageIndex) {\n          print('We arrived to the last widget');\n        });\n   ``` \n\nAlso you can use `CosmosEpub.openURLBook` and `CosmosEpub.openFileBook` for your convenience. \n\nFor clearing theming cache, use this method:\n\n  ```dart\n    await CosmosEpub.clearThemeCache();\n  ```\n\n## RTL Language Support 🌍\n\nCosmosEpub now includes comprehensive support for Right-to-Left (RTL) languages such as Arabic, Persian (Farsi), Hebrew, Urdu, and more.\n\n### Features:\n- **Automatic Detection**: The library automatically detects RTL content and applies appropriate text direction\n- **Smart Navigation**: Navigation buttons automatically reverse for RTL content (left arrow becomes \"next\" for RTL)\n- **Proper Alignment**: Text is properly aligned based on language direction\n- **Chapter List Support**: Table of contents supports RTL layout with proper indentation\n- **Mixed Content**: Handles documents with both LTR and RTL text seamlessly\n\n### Supported Languages:\n- Arabic (العربية)\n- Persian/Farsi (فارسی)\n- Hebrew (עברית)\n- Urdu (اردو)\n- Pashto (پښتو)\n- Sindhi (سنڌي)\n- Kurdish (کوردی)\n- Dhivehi/Maldivian (ދިވެހި)\n- Yiddish (ייִדיש)\n\n### Usage:\nNo additional configuration is required! Simply open your RTL EPUB file as usual:\n\n```dart\nawait CosmosEpub.openAssetBook(\n    assetPath: 'assets/arabic_book.epub',\n    context: context,\n    bookId: 'arabic_book_1',\n    onPageFlip: (currentPage, totalPages) {\n      print('Page: $currentPage of $totalPages');\n    },\n);\n```\n\nThe library will automatically:\n1. Detect the text direction from the content\n2. Apply proper RTL layout and navigation\n3. Handle mixed LTR/RTL content appropriately\n\n***Note: I haven't handled all exceptions, so control it on your own side. For example, if you give same bookId to the another book, it can open page and chapter from that book's progress or may break 💀***\n\n***Feel free to contact me if you have any questions: https://allmylinks.com/mamasodikov***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamasodikov%2Fcosmos_epub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmamasodikov%2Fcosmos_epub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamasodikov%2Fcosmos_epub/lists"}