Skip to content

Commit

Permalink
## 4.0.0-non-null-safety
Browse files Browse the repository at this point in the history
* Breaking change:

  1. we cache raw image pixels as default behavior at previous versions, it's not good for heap memory usage. so add [ExtendedImageProvider.cacheRawData] to support whether should cache the raw image pixels. It's [false] now.

* Improve:

  1. add [ExtendedResizeImage] to support resize image more convenient.
  2. add [ExtendedImageProvider.imageCacheName] to support custom ImageCache to store ExtendedImageProvider.
  3. add MemoryUsageDemo. #315

* Issues:
  1. fix issue that [EditorConfig.editActionDetailsIsChanged] is not fire when change crop area. #317
  • Loading branch information
zmtzawqlp committed Mar 23, 2021
1 parent 0d7f291 commit 4b1890b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 43 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
## 4.0.0-non-null-safety

* Breaking change:

1. we cache raw image pixels as default behavior at previous versions, it's not good for heap memory usage. so add [ExtendedImageProvider.cacheRawData] to support whether should cache the raw image pixels. It's [false] now.

* Improve:

1. add [ExtendedResizeImage] to support resize image more convenient.
2. add [ExtendedImageProvider.imageCacheName] to support custom ImageCache to store ExtendedImageProvider.
3. add MemoryUsageDemo. #315

* Issues:
1. fix issue that [EditorConfig.editActionDetailsIsChanged] is not fire when change crop area. #317
## 3.0.0-non-null-safety

* non-null-safety
* Breaking change:
Remove [TransparentMaterialPageRoute] and [TransparentMaterialPageRoute]
* Improve:
Add [ExtendedNetworkImageProvider.printError]

## 2.0.0

* Improve:
Expand Down
118 changes: 79 additions & 39 deletions lib/src/extended_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ class ExtendedImage extends StatefulWidget {
this.isAntiAlias = false,
String cacheKey,
bool printError = true,
}) : assert(cacheWidth == null || cacheWidth > 0),
double compressionRatio,
int maxBytes,
bool cacheRawData = false,
String imageCacheName,
}) : assert(url != null),
assert(cacheWidth == null || cacheWidth > 0),
assert(cacheHeight == null || cacheHeight > 0),
assert(isAntiAlias != null),
image = ResizeImage.resizeIfNeeded(
cacheWidth,
cacheHeight,
ExtendedNetworkImageProvider(
image = ExtendedResizeImage.resizeIfNeeded(
provider: ExtendedNetworkImageProvider(
url,
scale: scale,
headers: headers,
Expand All @@ -131,7 +133,15 @@ class ExtendedImage extends StatefulWidget {
timeLimit: timeLimit,
cacheKey: cacheKey,
printError: printError,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
compressionRatio: compressionRatio,
maxBytes: maxBytes,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
assert(constraints == null || constraints.debugAssertIsValid()),
constraints = (width != null || height != null)
Expand All @@ -154,7 +164,7 @@ class ExtendedImage extends StatefulWidget {
/// On Android, this may require the
/// `android.permission.READ_EXTERNAL_STORAGE` permission.
///
/// Use [filterQuality] to change the quality when scaling an image.
/// Use [filterQuality] to change the quality when scailing an image.
/// Use the [FilterQuality.low] quality setting to scale the image,
/// which corresponds to bilinear interpolation, rather than the default
/// [FilterQuality.none] which corresponds to nearest-neighbor.
Expand Down Expand Up @@ -200,21 +210,27 @@ class ExtendedImage extends StatefulWidget {
int cacheWidth,
int cacheHeight,
this.isAntiAlias = false,
}) : assert(cacheWidth == null || cacheWidth > 0),
double compressionRatio,
int maxBytes,
bool cacheRawData = false,
String imageCacheName,
}) : assert(file != null),
assert(cacheWidth == null || cacheWidth > 0),
assert(cacheHeight == null || cacheHeight > 0),
assert(isAntiAlias != null),
image = ResizeImage.resizeIfNeeded(
cacheWidth,
cacheHeight,
ExtendedFileImageProvider(
image = ExtendedResizeImage.resizeIfNeeded(
provider: ExtendedFileImageProvider(
file,
scale: scale,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
compressionRatio: compressionRatio,
maxBytes: maxBytes,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
assert(alignment != null),
assert(repeat != null),
assert(filterQuality != null),
assert(matchTextDirection != null),
constraints = (width != null || height != null)
? constraints?.tighten(width: width, height: height) ??
BoxConstraints.tightFor(width: width, height: height)
Expand Down Expand Up @@ -389,20 +405,37 @@ class ExtendedImage extends StatefulWidget {
int cacheWidth,
int cacheHeight,
this.isAntiAlias = false,
}) : assert(cacheWidth == null || cacheWidth > 0),
double compressionRatio,
int maxBytes,
bool cacheRawData = false,
String imageCacheName,
}) : assert(name != null),
assert(cacheWidth == null || cacheWidth > 0),
assert(cacheHeight == null || cacheHeight > 0),
assert(isAntiAlias != null),
image = ResizeImage.resizeIfNeeded(
cacheWidth,
cacheHeight,
scale != null
? ExtendedExactAssetImageProvider(name,
bundle: bundle, scale: scale, package: package)
: ExtendedAssetImageProvider(name,
bundle: bundle, package: package)),
assert(alignment != null),
assert(repeat != null),
assert(matchTextDirection != null),
image = ExtendedResizeImage.resizeIfNeeded(
provider: scale != null
? ExtendedExactAssetImageProvider(
name,
bundle: bundle,
scale: scale,
package: package,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
)
: ExtendedAssetImageProvider(
name,
bundle: bundle,
package: package,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
compressionRatio: compressionRatio,
maxBytes: maxBytes,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
constraints = (width != null || height != null)
? constraints?.tighten(width: width, height: height) ??
BoxConstraints.tightFor(width: width, height: height)
Expand Down Expand Up @@ -465,20 +498,27 @@ class ExtendedImage extends StatefulWidget {
int cacheWidth,
int cacheHeight,
this.isAntiAlias = false,
}) : assert(cacheWidth == null || cacheWidth > 0),
double compressionRatio,
int maxBytes,
bool cacheRawData = false,
String imageCacheName,
}) : assert(bytes != null),
assert(cacheWidth == null || cacheWidth > 0),
assert(cacheHeight == null || cacheHeight > 0),
assert(isAntiAlias != null),
image = ResizeImage.resizeIfNeeded(
cacheWidth,
cacheHeight,
ExtendedMemoryImageProvider(
image = ExtendedResizeImage.resizeIfNeeded(
provider: ExtendedMemoryImageProvider(
bytes,
scale: scale,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
compressionRatio: compressionRatio,
maxBytes: maxBytes,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
cacheRawData: cacheRawData,
imageCacheName: imageCacheName,
),
assert(alignment != null),
assert(repeat != null),
assert(matchTextDirection != null),
constraints = (width != null || height != null)
? constraints?.tighten(width: width, height: height) ??
BoxConstraints.tightFor(width: width, height: height)
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: extended_image
description: Official extension image, support placeholder(loading)/ failed state, cache network, zoom/pan, photo view, slide out page, editor(crop,rotate,flip), painting etc.
version: 3.0.0-non-null-safety
version: 4.0.0-non-null-safety
homepage: https://github.com/fluttercandies/extended_image

environment:
sdk: ">=2.6.0 <2.12.0"

flutter: '>1.17.0 <=1.22.6'
dependencies:
flutter:
sdk: flutter
extended_image_library: ^2.0.1-non-null-safety
extended_image_library: ^3.0.0-non-null-safety
meta: ^1.1.8

0 comments on commit 4b1890b

Please sign in to comment.