ViewerMediaSource class
A source for the ViewerMediaType, which handles primarily image-based media.
- Inheritance
-
- Object
- MediaSource
- ViewerMediaSource
- Implementers
Constructors
Properties
- aspectRatio → double
-
Aspect ratio of media items.
read-onlyoverride
- 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
- 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
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- 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
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
-
buildLaunchPage(
{MediaItem? item}) → BaseSourcePage -
The widget to show when this source is launched. An optional MediaItem
can be supplied as a launch parameter.
inherited
-
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.
inherited
-
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
-
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
-
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
-
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.
inherited
-
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
-
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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited