Skip to content

Commit

Permalink
Fixed bug that was giving error on copying background image. Closes #144
Browse files Browse the repository at this point in the history
.
  • Loading branch information
jonbhanson committed Mar 18, 2021
1 parent d563e4c commit 708b03e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.1.3] - (2021-Mar-18)

* Fixed bug that was giving error on copying background image. Closes [#144](https://github.com/jonbhanson/flutter_native_splash/issues/144).

## [1.1.2] - (2021-Mar-17)

* Check that image files exist before starting. Throw an exception if image file not found.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ First, add `flutter_native_splash` as a dev dependency in your pubspec.yaml file

```yaml
dev_dependencies:
flutter_native_splash: ^1.1.2
flutter_native_splash: ^1.1.3
```

Don't forget to `flutter pub get`.
Expand Down
6 changes: 6 additions & 0 deletions lib/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ void _createBackground({
file.createSync(recursive: true);
file.writeAsBytesSync(encodePng(background));
} else if (backgroundImageSource.isNotEmpty) {
// Copy will not work if the directory does not exist, so createSync
// will ensure that the directory exists.
File(backgroundImageDestination).createSync(recursive: true);
File(backgroundImageSource).copySync(backgroundImageDestination);
} else {
throw Exception('No color string or background image!');
Expand All @@ -255,6 +258,9 @@ void _createBackground({
file.createSync(recursive: true);
file.writeAsBytesSync(encodePng(background));
} else if (darkBackgroundImageSource.isNotEmpty) {
// Copy will not work if the directory does not exist, so createSync
// will ensure that the directory exists.
File(darkBackgroundImageSource).createSync(recursive: true);
File(darkBackgroundImageSource).copySync(darkBackgroundImageDestination);
} else {
final file = File(darkBackgroundImageDestination);
Expand Down
6 changes: 6 additions & 0 deletions lib/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void createBackgroundImages({
final file = File(_webSplashImagesFolder + 'light-background.png');
if (file.existsSync()) file.deleteSync();
} else {
// Copy will not work if the directory does not exist, so createSync
// will ensure that the directory exists.
File(backgroundImage).createSync(recursive: true);
File(backgroundImage)
.copySync(_webSplashImagesFolder + 'light-background.png');
}
Expand All @@ -56,6 +59,9 @@ void createBackgroundImages({
final file = File(_webSplashImagesFolder + 'dark-background.png');
if (file.existsSync()) file.deleteSync();
} else {
// Copy will not work if the directory does not exist, so createSync
// will ensure that the directory exists.
File(darkBackgroundImage).createSync(recursive: true);
File(darkBackgroundImage)
.copySync(_webSplashImagesFolder + 'dark-background.png');
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_native_splash
description: Generates native code to customize Flutter's default white native splash screen with background color and splash image. Supports dark mode, full screen, and more.
version: 1.1.2
version: 1.1.3
homepage: https://github.com/jonbhanson/flutter_native_splash

environment:
Expand Down

0 comments on commit 708b03e

Please sign in to comment.