Skip to content

Commit

Permalink
Updated image dependency to v4.0.10. Fixes jonbhanson#497. Changed im…
Browse files Browse the repository at this point in the history
…age processing from linear to cubic to improve image quality. Fixes jonbhanson#472.

(cherry picked from commit d67647b)
  • Loading branch information
jonbhanson authored and doananhtuan22111996 committed May 27, 2023
1 parent 8badc1e commit b6c9cc4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.2.17] - (2023-Jan-15)
- Updated image dependency to v4.0.10. Fixes [#497](https://github.com/jonbhanson/flutter_native_splash/issues/497).
- Changed image processing from linear to cubic to improve image quality. Fixes [#472](https://github.com/jonbhanson/flutter_native_splash/issues/472).

## [2.2.16] - (2022-Nov-27)

- Update documentation on Android 12.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.

```yaml
dependencies:
flutter_native_splash: ^2.2.16
flutter_native_splash: ^2.2.17
```

Don't forget to `flutter pub get`.
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.2.15"
version: "2.2.17"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -120,7 +120,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
version: "4.0.10"
js:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion lib/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void _saveImageAndroid({
image,
width: image.width * template.pixelDensity ~/ 4,
height: image.height * template.pixelDensity ~/ 4,
interpolation: Interpolation.linear,
interpolation: Interpolation.cubic,
);

// Whne the flavor value is not specified we will place all the data inside the main directory.
Expand Down
16 changes: 7 additions & 9 deletions lib/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void _createiOSSplash({
if (imagePath != null) {
_applyImageiOS(imagePath: imagePath, list: _iOSSplashImages);
} else {
final splashImage = Image(1, 1);
final splashImage = Image(width: 1, height: 1);
for (final template in _iOSSplashImages) {
final file =
File(_flavorHelper.iOSAssetsLaunchImageFolder + template.fileName);
Expand Down Expand Up @@ -200,7 +200,7 @@ void _saveImageiOS({
image,
width: image.width * template.pixelDensity ~/ 4,
height: image.height * template.pixelDensity ~/ 4,
interpolation: Interpolation.linear,
interpolation: Interpolation.cubic,
);

final file = File(targetPath + template.fileName);
Expand Down Expand Up @@ -422,12 +422,12 @@ void _createBackground({
required String darkBackgroundImageDestination,
}) {
if (colorString != null) {
final background = Image(1, 1);
final background = Image(width: 1, height: 1);
final redChannel = int.parse(colorString.substring(0, 2), radix: 16);
final greenChannel = int.parse(colorString.substring(2, 4), radix: 16);
final blueChannel = int.parse(colorString.substring(4, 6), radix: 16);
background.fill(
0xFF000000 + (blueChannel << 16) + (greenChannel << 8) + redChannel,
background.clear(
ColorRgb8(redChannel, greenChannel, blueChannel),
);
final file = File(backgroundImageDestination);
file.createSync(recursive: true);
Expand All @@ -442,13 +442,11 @@ void _createBackground({
}

if (darkColorString != null) {
final background = Image(1, 1);
final background = Image(height: 1, width: 1);
final redChannel = int.parse(darkColorString.substring(0, 2), radix: 16);
final greenChannel = int.parse(darkColorString.substring(2, 4), radix: 16);
final blueChannel = int.parse(darkColorString.substring(4, 6), radix: 16);
background.fill(
0xFF000000 + (blueChannel << 16) + (greenChannel << 8) + redChannel,
);
background.clear(ColorRgb8(redChannel, greenChannel, blueChannel));
final file = File(darkBackgroundImageDestination);
file.createSync(recursive: true);
file.writeAsBytesSync(encodePng(background));
Expand Down
2 changes: 1 addition & 1 deletion lib/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void _saveImageWeb({
image,
width: image.width * template.pixelDensity ~/ 4,
height: image.height * template.pixelDensity ~/ 4,
interpolation: Interpolation.linear,
interpolation: Interpolation.cubic,
);

final file = File(_webSplashImagesFolder + template.fileName);
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_native_splash
description: Customize Flutter's default white native splash screen with
background color and splash image. Supports dark mode, full screen, and more.
version: 2.2.16
version: 2.2.17
repository: https://github.com/jonbhanson/flutter_native_splash
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues

Expand All @@ -17,7 +17,7 @@ dependencies:
sdk: flutter
js: ^0.6.4
html: ^0.15.1
image: ^3.2.2
image: ^4.0.10
meta: ^1.8.0
path: ^1.8.2
universal_io: ^2.0.4
Expand Down

0 comments on commit b6c9cc4

Please sign in to comment.