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}
|
||||
///
|
||||
/// This sample shows how to supply your own caching logic and replace the
|
||||
/// global [imageCache] varible.
|
||||
/// global [imageCache] variable.
|
||||
///
|
||||
/// ```dart
|
||||
/// /// This is the custom implementation of [ImageCache] where we can override
|
||||
@ -64,7 +64,6 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
|
||||
class ImageCache {
|
||||
final Map<Object, _PendingImage> _pendingImages = <Object, _PendingImage>{};
|
||||
final Map<Object, _CachedImage> _cache = <Object, _CachedImage>{};
|
||||
@ -141,12 +140,13 @@ class ImageCache {
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// it from adding itself to the cache if it eventually completes.
|
||||
/// When a pending image is removed the listener on it is removed as well to
|
||||
/// 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].
|
||||
///
|
||||
/// 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.
|
||||
@immutable
|
||||
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.
|
||||
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
|
||||
/// 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
|
||||
/// height and width that should be used when painting the image (e.g. in the
|
||||
/// arguments given to [Canvas.drawImage]).
|
||||
/// by the [dart:ui.Image.width] and [dart:ui.Image.height] properties) are
|
||||
/// double the height and width that should be used when painting the image
|
||||
/// (e.g. in the arguments given to [Canvas.drawImage]).
|
||||
final double scale;
|
||||
|
||||
@override
|
||||
@ -58,11 +58,11 @@ class ImageInfo {
|
||||
|
||||
/// 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
|
||||
/// as a listener (e.g. via [ImageStream.addListener]), you can instantiate a
|
||||
/// _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.
|
||||
///
|
||||
/// Used by [ImageStream] and [ImageStreamCompleter].
|
||||
|
Loading…
x
Reference in New Issue
Block a user