File tree Expand file tree Collapse file tree 5 files changed +18
-6
lines changed
cached_network_image_platform_interface/lib
cached_network_image/lib/src/image_provider Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import 'package:cached_network_image_platform_interface'
12
12
'/cached_network_image_platform_interface.dart'
13
13
show ImageRenderMethodForWeb;
14
14
15
+ /// ImageLoader class to load images on IO platforms.
15
16
class ImageLoader implements platform.ImageLoader {
16
17
@override
17
18
Stream <ui.Codec > loadAsync (
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class CachedNetworkImageProvider
36
36
this .imageRenderMethodForWeb = ImageRenderMethodForWeb .HtmlImage ,
37
37
});
38
38
39
+ /// CacheManager from which the image files are loaded.
39
40
final BaseCacheManager ? cacheManager;
40
41
41
42
/// Web url of the image to load
@@ -53,10 +54,15 @@ class CachedNetworkImageProvider
53
54
/// Set headers for the image provider, for example for authentication
54
55
final Map <String , String >? headers;
55
56
57
+ /// Maximum height of the loaded image. If not null and using an
58
+ /// [ImageCacheManager] the image is resized on disk to fit the height.
56
59
final int ? maxHeight;
57
60
61
+ /// Maximum width of the loaded image. If not null and using an
62
+ /// [ImageCacheManager] the image is resized on disk to fit the width.
58
63
final int ? maxWidth;
59
64
65
+ /// Render option for images on the web platform.
60
66
final ImageRenderMethodForWeb imageRenderMethodForWeb;
61
67
62
68
@override
Original file line number Diff line number Diff line change @@ -6,17 +6,21 @@ import 'dart:ui' as ui;
6
6
import 'package:flutter/material.dart' ;
7
7
import 'package:flutter_cache_manager/flutter_cache_manager.dart' ;
8
8
9
+ /// Render options for images on the web platform.
9
10
enum ImageRenderMethodForWeb {
10
11
/// HtmlImage uses a default web image including default browser caching.
11
12
/// This is the recommended and default choice.
12
- HtmlImage ,
13
+ HtmlImage , // ignore: constant_identifier_names
13
14
14
15
/// HttpGet uses an http client to fetch an image. It enables the use of
15
16
/// headers, but loses some default web functionality.
16
- HttpGet ,
17
+ HttpGet , // ignore: constant_identifier_names
17
18
}
18
19
20
+ /// ImageLoader class to load images differently on various platforms.
19
21
class ImageLoader {
22
+ /// loads the images async and gives the resulted codecs on a Stream. The
23
+ /// Stream gives the option to show multiple images after each other.
20
24
Stream <ui.Codec > loadAsync (
21
25
String url,
22
26
String ? cacheKey,
Original file line number Diff line number Diff line change @@ -12,12 +12,16 @@ import 'package:cached_network_image_platform_interface'
12
12
import 'package:flutter/material.dart' ;
13
13
import 'package:flutter_cache_manager/flutter_cache_manager.dart' ;
14
14
15
+ // ignore: avoid_web_libraries_in_flutter
15
16
import 'dart:html' as html;
17
+ // ignore: avoid_web_libraries_in_flutter
16
18
import 'dart:js_util' as js_util;
17
19
import 'dart:typed_data' ;
18
20
import 'dart:ui' as skia;
19
21
22
+ /// ImageLoader class to load images on the web platform.
20
23
class ImageLoader implements platform.ImageLoader {
24
+ @override
21
25
Stream <ui.Codec > loadAsync (
22
26
String url,
23
27
String ? cacheKey,
Original file line number Diff line number Diff line change 1
- import 'package:flutter_test/flutter_test.dart' ;
2
-
3
- import 'package:cached_network_image_web/cached_network_image_web.dart' ;
4
-
5
1
void main () {
2
+ // missing tests :(
6
3
}
You can’t perform that action at this time.
0 commit comments