Doc fixes in Image related docs (#48994)
This commit is contained in:
parent
d0c4458b80
commit
cb5918f626
@ -32,7 +32,7 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// {@tool snippet}
|
/// {@tool snippet}
|
||||||
///
|
///
|
||||||
/// This sample shows how to supply your own caching logic and replace the
|
/// This sample shows how to supply your own caching logic and replace the
|
||||||
/// global [imageCache] varible.
|
/// global [imageCache] variable.
|
||||||
///
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// /// This is the custom implementation of [ImageCache] where we can override
|
/// /// This is the custom implementation of [ImageCache] where we can override
|
||||||
@ -64,7 +64,6 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// {@end-tool}
|
/// {@end-tool}
|
||||||
|
|
||||||
class ImageCache {
|
class ImageCache {
|
||||||
final Map<Object, _PendingImage> _pendingImages = <Object, _PendingImage>{};
|
final Map<Object, _PendingImage> _pendingImages = <Object, _PendingImage>{};
|
||||||
final Map<Object, _CachedImage> _cache = <Object, _CachedImage>{};
|
final Map<Object, _CachedImage> _cache = <Object, _CachedImage>{};
|
||||||
@ -141,12 +140,13 @@ class ImageCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Evicts a single entry from the cache, returning true if successful.
|
/// Evicts a single entry from the cache, returning true if successful.
|
||||||
/// Pending images waiting for completion are removed as well, returning true if successful.
|
/// Pending images waiting for completion are removed as well, returning true
|
||||||
|
/// if successful.
|
||||||
///
|
///
|
||||||
/// When a pending image is removed the listener on it is removed as well to prevent
|
/// When a pending image is removed the listener on it is removed as well to
|
||||||
/// it from adding itself to the cache if it eventually completes.
|
/// prevent it from adding itself to the cache if it eventually completes.
|
||||||
///
|
///
|
||||||
/// The [key] must be equal to an object used to cache an image in
|
/// The `key` must be equal to an object used to cache an image in
|
||||||
/// [ImageCache.putIfAbsent].
|
/// [ImageCache.putIfAbsent].
|
||||||
///
|
///
|
||||||
/// If the key is not immediately available, as is common, consider using
|
/// If the key is not immediately available, as is common, consider using
|
||||||
|
@ -15,7 +15,7 @@ import 'package:flutter/scheduler.dart';
|
|||||||
/// actual data of the image once it has been obtained.
|
/// actual data of the image once it has been obtained.
|
||||||
@immutable
|
@immutable
|
||||||
class ImageInfo {
|
class ImageInfo {
|
||||||
/// Creates an [ImageInfo] object for the given image and scale.
|
/// Creates an [ImageInfo] object for the given [image] and [scale].
|
||||||
///
|
///
|
||||||
/// Both the image and the scale must not be null.
|
/// Both the image and the scale must not be null.
|
||||||
const ImageInfo({ @required this.image, this.scale = 1.0 })
|
const ImageInfo({ @required this.image, this.scale = 1.0 })
|
||||||
@ -35,9 +35,9 @@ class ImageInfo {
|
|||||||
///
|
///
|
||||||
/// For example, if this is 2.0 it means that there are four image pixels for
|
/// For example, if this is 2.0 it means that there are four image pixels for
|
||||||
/// every one logical pixel, and the image's actual width and height (as given
|
/// every one logical pixel, and the image's actual width and height (as given
|
||||||
/// by the [dart:ui.Image.width] and [dart:ui.Image.height] properties) are double the
|
/// by the [dart:ui.Image.width] and [dart:ui.Image.height] properties) are
|
||||||
/// height and width that should be used when painting the image (e.g. in the
|
/// double the height and width that should be used when painting the image
|
||||||
/// arguments given to [Canvas.drawImage]).
|
/// (e.g. in the arguments given to [Canvas.drawImage]).
|
||||||
final double scale;
|
final double scale;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -58,11 +58,11 @@ class ImageInfo {
|
|||||||
|
|
||||||
/// Interface for receiving notifications about the loading of an image.
|
/// Interface for receiving notifications about the loading of an image.
|
||||||
///
|
///
|
||||||
/// This class overrides `operator ==` and `hashCode` to compare the individual
|
/// This class overrides [operator ==] and [hashCode] to compare the individual
|
||||||
/// callbacks in the listener, meaning that if you add an instance of this class
|
/// callbacks in the listener, meaning that if you add an instance of this class
|
||||||
/// as a listener (e.g. via [ImageStream.addListener]), you can instantiate a
|
/// as a listener (e.g. via [ImageStream.addListener]), you can instantiate a
|
||||||
/// _different_ instance of this class when you remove the listener, and the
|
/// _different_ instance of this class when you remove the listener, and the
|
||||||
/// listener will be properly removed as long all associated callbacks are
|
/// listener will be properly removed as long as all associated callbacks are
|
||||||
/// equal.
|
/// equal.
|
||||||
///
|
///
|
||||||
/// Used by [ImageStream] and [ImageStreamCompleter].
|
/// Used by [ImageStream] and [ImageStreamCompleter].
|
||||||
|
Loading…
x
Reference in New Issue
Block a user