BookReader class
BookReader is a widget used to read book. It provide some way to paginate and can be customized by you own choice since we provide many params to do that.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BookReader
Constructors
-
BookReader({Key? key, required String author, required Widget cover, int? cursor, bool darkMode = false, Duration? duration, bool eInkMode = false, required Future<
String> future(int), int? index, List<PageTurningMode> modes = PageTurningMode.values, required String name, ReaderTheme? theme, String? title, int? total, void onBookPressed()?, void onCached(int amount)?, void onCataloguePressed()?, void onChapterChanged(int index)?, void onDarkModePressed()?, void onDetailPressed()?, void onMessage(String)?, void onPop(int index, int cursor)?, void onProgressChanged(int)?, Future<String> onRefresh(int)?, void onSettingPressed()?, void onSourcePressed()?}) -
author, cover, name should not be null.
future is used to fetch content from internet or some other way.
const
Properties
-
Author of book, can be null if you weren't sure about it.
final
- cover → Widget
-
Basically a cover of book, should be an image.
final
- cursor → int?
-
The value of cursor is the index of pages paginated with style
given. If it is null then the default value is 0.
final
- darkMode → bool
-
Current dark mode of app.
final
- duration → Duration?
-
Duration for animation, include app and bottom bar slide transition,
and page transition automated.
final
- eInkMode → bool
-
final
-
future
→ Future<
String> Function(int) -
Used to fetch content from internet or some other way.
NOTICE
This function can not usesetState
in it because this should be called inbuild
function.final - hashCode → int
-
The hash code for this object.
no setterinherited
- index → int?
-
Current index of chapters.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
modes
→ List<
PageTurningMode> -
Determine how to trigger page change
final
- name → String
-
Name of book, used to displayed in header and detail modal.
final
- onBookPressed → (void Function()?)
-
If onBookPressed is null, then the button of detail should not be
available. And this function is used to navigate to a new page to
show detail of book and something else you wanna display.
final
- onCached → (void Function(int amount)?)
-
This is used to cache data from internet or some other way, and the
param is the amount of chapters should be cached.
final
- onCataloguePressed → (void Function()?)
-
If this function is null then the button of catalogue should not be
available. And this is used to navigate to the new page to display
custom catalogue page.
final
- onChapterChanged → (void Function(int index)?)
-
This function will be called when change chapter. And use future to
fetch data instead of here.
final
- onDarkModePressed → (void Function()?)
-
final
- onDetailPressed → (void Function()?)
-
final
- onMessage → (void Function(String)?)
-
final
- onPop → (void Function(int index, int cursor)?)
-
When exit the reader page, use this to do something you ever want to.
The first param should be the current index of chapters and the
second param should be the cursor of pages.
final
- onProgressChanged → (void Function(int)?)
-
final
-
onRefresh
→ (Future<
String> Function(int)?) -
final
- onSettingPressed → (void Function()?)
-
This is used to navigate to the new page to display settings.
final
- onSourcePressed → (void Function()?)
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → ReaderTheme?
-
final
- title → String?
-
Title of chapter, used to displayed in header while is not first page.
final
- total → int?
-
Amount of chapters, if total is null then the default value
1
would be used.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BookReader> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited