Skip to content

Latest commit

 

History

History
48 lines (39 loc) · 2.29 KB

File metadata and controls

48 lines (39 loc) · 2.29 KB

ReadiumReaderWidget

ReadiumReaderWidget embeds the native Readium navigator view. It requires an open Publication.

Constructor

ReadiumReaderWidget(
  publication: pub,           // required — from openPublication()
  initialLocator: saved,      // optional — restores reading position
  loadingWidget: mySpinner,   // shown while the native view initialises
  shouldShowControls: true,   // whether built-in nav controls are shown
  verticalScroll: false,      // overrides scroll mode preference
  onExternalLinkActivated: (uri) { /* handle external URLs */ },
  goBackwardSemanticLabel: 'Previous page',
  goForwardSemanticLabel: 'Next page',
  toggleShowControlsSemanticLabel: 'Toggle controls',
)

Parameters

Parameter Type Default Description
publication Publication required The open publication to display
initialLocator Locator? null Position to restore on open
loadingWidget Widget? CircularProgressIndicator Shown while native view loads
shouldShowControls bool true Show built-in navigation controls
verticalScroll bool? from preferences Override scroll/paginated mode
onExternalLinkActivated void Function(Uri)? null Called when the reader activates an external link
goBackwardSemanticLabel String? null Accessibility label for the backward control
goForwardSemanticLabel String? null Accessibility label for the forward control
toggleShowControlsSemanticLabel String? null Accessibility label for the controls toggle

Platform implementations

Platform Implementation
Android PlatformViewLink with AndroidViewSurface
iOS UiKitView wrapping a native UIView
macOS (desktop) Not supported — stub registered on flutter run -d macos; for Mac users, ship the iOS build via "Designed for iPad"
Web JavaScript interop via ReadiumWebView

Lifecycle notes

  • The widget registers itself with FlutterReadiumPlatform.instance on creation and deregisters on disposal.
  • Screen wakelock is managed automatically while the widget is mounted.
  • Dispose the owning widget (and call closePublication()) when navigation leaves the reader screen.