LogoSkills

feature-book_content_viewer

book_content_viewer feature brick - book content viewer functionality. Generate Clean Architecture feature module with mason make feature-book_content_viewer.

Generates a Clean Architecture-based feature module for book content viewer functionality. A large-scale feature module that includes all core e-book viewer features such as PDF page rendering, bookmarks, scribbles, markers, reading progress management, TTS, and in-app purchases.

Quick Start#

mason make feature-book_content_viewer \
  --project_name my_app \
  --org_name myorg \
  --feature_name book_content_viewer
# Generate with custom entity name
mason make feature-book_content_viewer \
  --feature_name ebook_viewer \
  --primary_entity EbookContent \
  --secondary_entity ViewerProgress

Variables#

VariableTypeDefaultDescription
project_namestring-Project name (snake_case)
org_namestring-Organization name
org_tldstringcomTop-level domain
feature_name string book_content_viewer Feature module name (snake_case)
primary_entity string BookContent Primary domain entity name (PascalCase)
secondary_entity string ReadingProgress Secondary domain entity name (PascalCase)

Generated Structure#

feature/application/{feature_name}/
├── lib/
│   ├── {feature_name}.dart
│   └── src/
│       ├── data/         # Repository implementation
│       ├── domain/       # Entity, UseCase, Repository Interface
│       ├── presentation/ # BLoC, Page, Widget
│       ├── route/        # GoRouter TypedRoute
│       └── di/           # Dependency Injection
└── test/                 # Unit, BDD tests

Backend Module#

A Serverpod backend module is generated alongside:

backend/ { { project_name } } _server/lib/src/feature/ { { feature_name } } /
├── endpoint/     # CRUD endpoints
├── service/      # Business logic
├── model/        # Entity, DTO (.spy.yaml)
├── exception/    # Exception handling
├── validation/   # Input validation
└── test/         # Tests

Key Components#

Domain#

  • Entities: PageViewModel, PdfImageCacheManager
  • UseCases: Book(Get, CheckPurchase), Bookmark(Toggle, Get, Update, Delete), Scribble(Save/Load/Delete Local, Upload/Download Server, Merge/Split), Marker(Create, Update, Delete, GetPage, GetTotal), PDF(Download, Merge, ClearCache), Payment(ChargeWallet, GetPackages, GetBalance, GetCoupons, ValidateCoupon, Purchase), Progress(Get, Update), TTS(Speak, Stop), ScreenProtectToggle
  • Repositories: IBookContentViewerRepository, IBookmarkRepository, IPdfMarkerRepository, IS3OperationRepository, IScribbleRepository, ITextHighlightRepository

Presentation#

  • BLoC: BookContentViewerBloc, ScribbleBloc, ViewerPaymentBloc
  • Pages: BookContentViewerPage

Customization#

Changing the feature_name variable automatically updates all file names, class names, and import paths:

mason make feature-book_content_viewer --feature_name pdf_viewer