diff --git a/CHANGELOG.md b/CHANGELOG.md index ef9eea8..d417770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 0a9a6e1..7322978 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/lib/ios.dart b/lib/ios.dart index d794638..bfe9fcd 100644 --- a/lib/ios.dart +++ b/lib/ios.dart @@ -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!'); @@ -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); diff --git a/lib/web.dart b/lib/web.dart index 795b218..e98d34b 100644 --- a/lib/web.dart +++ b/lib/web.dart @@ -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'); } @@ -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'); } diff --git a/pubspec.yaml b/pubspec.yaml index 00260ba..78956a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: