ReaderTtuSource class
A media source that allows the user to read from ッツ Ebook Reader.
- Inheritance
-
- Object
- MediaSource
- ReaderMediaSource
- ReaderTtuSource
Properties
- adaptTtuTheme → bool
-
Whether or not the dictionary popup should adapt to the reader's theme.
read-only
- aspectRatio → double
-
Aspect ratio of media items.
read-onlyinherited
- currentExtraData → String?
-
This is used to hold data for generating images and audio.
read-onlyinherited
- currentMediaItem → MediaItem
-
Supplies a media item that can be used for tracking and updating history,
as well as generating video and audio with timestamp information. This
should be uniquely implemented for each source. Some sources may want
to generate their media item based on current playback information or
progress.
read-onlyinherited
- currentSentence → JidoujishoTextSelection
-
Supplies a sentence that can be used for the sentence field when making
a card while this source is active. Can be set with setCurrentSentence
and clearCurrentSentence in a source page.
read-onlyinherited
- currentTtuInternalVersion → int?
-
Used to check for the current version.
read-only
- description → String
-
A longer description of what the source can do, or details left by or
regarding the developer.
finalinherited
-
descriptionLocalisation
→ Map<
String, String> -
Localisations for this source, where the key is a locale tag and
the value is the description of the enhancement. If the value for the
current locale is non-null, it will be used instead of description.
finalinherited
-
Whether or not to add to extend the webpage beyond the navigation bar.
This may be helpful for devices that don't have difficulty accessing the
top bar (i.e. don't have a teardrop notch).
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- highlightOnTap → bool
-
Whether the reader will highlight words on tap.
read-only
- icon → IconData
-
An icon that will show the enhancement if activated by the user in the
quick menu.
finalinherited
- implementsHistory → bool
-
Whether or not this media source allows adding items to media history.
Note that some media sources produce a history of media items but do
not require this to be set true. For example, the reader fetches its
history from a source other than the actual internal media history
system provided by the media source framework. In such cases, this
should be set as false. Setting this as true results to a media item
being added to history when media is opened.
finalinherited
- implementsSearch → bool
-
Whether or not this media source has a search function. If false, this
media source will have an action executed by onSearchBarTap.
finalinherited
- mediaType → MediaType
-
The media type that this source is for.
finalinherited
- overridesAutoAudio → bool
-
Whether or not a media source overrides the auto audio enhancement.
See generateAudio.
finalinherited
- overridesAutoImage → bool
-
Whether or not a media source overrides the auto image enhancement.
See generateImages.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- shouldGenerateAudio → bool
-
Gets whether or not a media source should currently supply audio.
read-onlyinherited
- shouldGenerateImage → bool
-
Gets whether or not a media source should currently supply images.
read-onlyinherited
- sourceName → String
-
Name of the source that very shortly describes what it does.
finalinherited
-
sourceNameLocalisatiton
→ Map<
String, String> -
Localisations for this source, where the key is a locale tag and
the value is the sourceName of the source. If the value for the current
locale is non-null, it will be used instead of sourceName.
finalinherited
- uniqueKey → String
-
A unique name that allows distinguishing this type from others,
particularly for the purposes of differentiating between persistent
settings keys.
finalinherited
- volumePageTurningEnabled → bool
-
Whether or not using the volume buttons in the Reader should turn the
page.
read-only
- volumePageTurningInverted → bool
-
Controls which direction is up or down for volume button page turning.
read-only
- volumePageTurningSpeed → int
-
Controls the speed for volume button page turning.
read-only
Methods
-
buildBar(
) → BaseMediaSearchBar? -
Used to override the search bar if needed by a source that implements search.
inherited
-
buildHistoryPage(
{MediaItem? item}) → BasePage -
The body widget to show in the tab when this source's media type and this
source is selected.
override
-
buildLaunchButton(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → Widget - Allows user to close the floating search bar of a media type tab page when open.
-
buildLaunchPage(
{MediaItem? item}) → BaseSourcePage -
The widget to show when this source is launched. An optional MediaItem
can be supplied as a launch parameter.
override
-
buildSettingsButton(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → Widget - Allows user to close the floating search bar of a media type tab page when open.
-
buildTweaksButton(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → Widget - Tweaks bar action.
-
clearCurrentSentence(
) → void -
Clear the current sentence.
inherited
-
clearExtraData(
) → void -
Clear extra export data.
inherited
-
clearOverrideValues(
{required AppModel appModel, required MediaItem item}) → Future< void> -
Used to clear override values of a MediaItem upon deletion.
inherited
-
deletePreference(
{required String key}) → Future< void> -
Set the preference for a certain parameter
key
for this source.inherited -
generateAudio(
{required AppModel appModel, required MediaItem item, List< Subtitle> ? subtitles, SubtitleOptions? options, String? data}) → Future<File?> ? -
If this source is non-null, this will be used as the initial function
for the audio field over the auto enhancement.
inherited
-
generateImages(
{required AppModel appModel, required MediaItem item, List< Subtitle> ? subtitles, SubtitleOptions? options, String? data}) → Future<List< NetworkToFileImage> > -
If this source is non-null, this will be used as the initial function
for the image field over the auto enhancement. Extra durations can be
invoked and defined when initially opening the creator, to call attention
to multiple durations to be used for image generation.
inherited
-
generateSearchSuggestions(
String searchTerm) → Future< List< String> > -
Given a search term, this source may give search suggestions. If the
empty list is returned, then search history will be shown instead.
inherited
-
getActions(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → List< Widget> -
Get the floating search bar actions of this source when it is the active
source being displayed on its respective media type tab.
override
-
getBooksHistory(
{required AppModel appModel, required Language language, bool recursive = false}) → Future< List< MediaItem> > - Fetch JSON for all books in IndexedDB.
-
getDisplaySubtitleFromMediaItem(
MediaItem item) → String -
Given a MediaItem, return its subtitle. Some media items may allow
overriding of values for display purposes. If a source does this,
override this function.
inherited
-
getDisplayThumbnailFromMediaItem(
{required AppModel appModel, required MediaItem item, String? fallbackUrl, bool noOverride = false}) → ImageProvider< Object> -
Given a MediaItem, return its thumbnail. Some media items may allow
overriding of values for display purposes.
inherited
-
getDisplayTitleFromMediaItem(
MediaItem item) → String -
Given a MediaItem, return its title. Some media items may allow
overriding of values for display purposes. If a source does this,
override this function.
inherited
-
getIndexedDBKey(
Language language) → String - Get the IndexedDB backup key for a language
-
getItemsFromJson(
Map< String, dynamic> json, int port) → List<MediaItem> - Fetch the list of history items given JSON from IndexedDB.
-
getLocalisedDescription(
AppModel appModel) → String -
Get the best localisation for the description of this media source. If
there is no localisation, the fallback is description.
inherited
-
getLocalisedSourceName(
AppModel appModel) → String -
Get the best localisation for the label of this media source. If there
is no localisation, the fallback is sourceName.
inherited
-
getOverrideThumbnailFilename(
{required AppModel appModel, required MediaItem item}) → String -
The map value used to store the override thumbnail of an item.
inherited
-
getOverrideThumbnailFromMediaItem(
{required AppModel appModel, required MediaItem item}) → ImageProvider< Object> ? -
Given a MediaItem, return its override display thumbnail.
inherited
-
getOverrideTitleFromMediaItem(
MediaItem item) → String? -
Given a MediaItem, return its override display title.
inherited
-
getOverrideTitleKey(
MediaItem item) → String -
The map key used to store the override title of an item.
inherited
-
getPortForLanguage(
Language language) → int - Get the port for the current language. This port should ideally not conflict but should remain the same for caching purposes.
-
getPreference<
T> ({required String key, required T defaultValue}) → T -
Get the preference value for a certain parameter
key
for this source.inherited -
getThumbnailUri(
{required AppModel appModel, required MediaItem item, bool noOverride = false}) → String -
Given a MediaItem, return its thumbnail. Some media items may allow
overriding of values for display purposes.
inherited
-
importBackup(
{required InAppWebViewController controller, required Language language, required String data}) → Future< void> - Import persisted backup data back to IndexedDB if it exists.
-
initialise(
) → Future< void> -
This function is run at startup. It is not called again if already run.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMediaItemClear(
MediaItem item) → Future< void> -
This function can be used to clean up resources associated with a
media item upon clearing it.
inherited
-
onSearchBarTap(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → Future< void> -
If this is not null, this action is executed when the user taps on the
search bar. Sources that do not have a search action should have this
defined.
inherited
-
onSourceExit(
{required AppModel appModel, required BuildContext context, required WidgetRef ref}) → Future< void> -
Executed when this media source is closed. Perform this step to clean up
resources or refresh media history.
override
-
prepareResources(
) → Future< void> -
If a media source requires resources to function, they can be prepared
here and this function will be run once only at runtime during the
initialisation step.
inherited
-
searchMediaItems(
{required BuildContext context, required String searchTerm, required int pageKey}) → Future< List< MediaItem> ?> -
This returns a list of MediaItem, and is performed to search the media
source for items.
inherited
-
serveLocalAssets(
Language language) → Future< LocalAssetsServer> - For serving the reader assets locally.
-
setCurrentSentence(
{required JidoujishoTextSelection selection}) → void -
Update the current sentence.
inherited
-
setExtraData(
String? value) → void -
Set extra export data. This should be simplified in the future and be
used as the main way of communicating parameters to the creator for
creating override images/audio information. There should not be media
source specific parameters for general functions like generating images
or audio.
inherited
-
setOverrideThumbnailFromMediaItem(
{required AppModel appModel, required MediaItem item, required File? file, required bool clearOverrideImage}) → Future< void> -
Given a MediaItem, set its override display thumbnail. If null, this
deletes the override thumbnail.
inherited
-
setOverrideTitleFromMediaItem(
{required MediaItem item, required String? title}) → Future< void> -
Given a MediaItem, set its override display title. If the title is
blank, the override title is cleared.
inherited
-
setPreference<
T> ({required String key, required T value}) → Future< void> -
Set the preference
value
for a certain parameterkey
for this source.inherited -
setShouldGenerateAudio(
{required bool value}) → void -
Controls whether or not a media source should currently supply audio.
inherited
-
setShouldGenerateImage(
{required bool value}) → void -
Controls whether or not a media source should currently supply images.
inherited
-
setTtuInternalVersion(
) → void - Sets the new version.
-
setVolumePageTurningSpeed(
int speed) → void - Sets the speed for volume button page turning.
-
showClearPrompt(
{required BuildContext context, required WidgetRef ref, required AppModel appModel}) → void - Shows when the clear button is pressed.
-
toggleAdaptTtuTheme(
) → void - Toggles whether dictionary popup should adapt to the reader's theme.
- Toggles the extend navbar option.
-
toggleHighlightOnTap(
) → void - Toggles whether the reader will highlight words on tap.
-
toggleVolumePageTurningEnabled(
) → void - Toggles the volume page turning option.
-
toggleVolumePageTurningInverted(
) → void - Inverts the current volume button page turning direction preference.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultScrollingSpeed → int
-
Default scrolling speed when in continuous page turning mode.
read-only
- instance → ReaderTtuSource
-
Get the singleton instance of this media type.
read-only
Constants
- get → const String
-
Used to fetch JSON for all books in IndexedDB.
''' indexedDB.databases().then((databases) => { if (databases.length > 0) { var bookmarkJson = JSON.stringify([]); var dataJson = JSON.stringify([]); var lastItemJson =…
- getHistoryJs → const String
-
Used to fetch JSON for all books in IndexedDB.
''' indexedDB.databases().then((databases) => { if (databases.length > 0) { var bookmarkJson = JSON.stringify([]); var dataJson = JSON.stringify([]); var lastItemJson =…
- ttuInternalVersion → const int
-
This ensures that the internal version included with the app always uses
the cache and is consistent. If this version changes and the current stored
last version mismatches, a load from network is forced. The app will then
update its new last version, and all new loads will be from the cache
unless there is a new app version loaded with a different internal version.
2