diff --git a/CHANGELOG.md b/CHANGELOG.md index dc36b45..befafe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [2.2.3] - (2022-June-5) +* Create new storyboard file rather than try to modify existing file. Closes [#369](https://github.com/jonbhanson/flutter_native_splash/issues/369). +* Reverted 2.1.6 change of using light settings for dark mode if omitted. Fixes [#368](https://github.com/jonbhanson/flutter_native_splash/issues/368). ## [2.2.2] - (2022-May-29) * Corrected Android 12 color overriding color parameter. Closes [#365](https://github.com/jonbhanson/flutter_native_splash/issues/365). * Add support for setting screen orientation in Android. Closes [#344](https://github.com/jonbhanson/flutter_native_splash/issues/344). diff --git a/README.md b/README.md index d23a27f..2765fb9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file. ```yaml dependencies: - flutter_native_splash: ^2.2.2 + flutter_native_splash: ^2.2.3 ``` Don't forget to `flutter pub get`. diff --git a/lib/cli_commands.dart b/lib/cli_commands.dart index 6123d1c..2c675c2 100644 --- a/lib/cli_commands.dart +++ b/lib/cli_commands.dart @@ -46,27 +46,18 @@ void createSplash({String? path, String? flavor}) { void createSplashByConfig(Map config) { // Preparing all the data for later usage final String? image = _checkImageExists(config: config, parameter: 'image'); - String? darkImage = + final String? darkImage = _checkImageExists(config: config, parameter: 'image_dark'); final String? brandingImage = _checkImageExists(config: config, parameter: 'branding'); - String? brandingDarkImage = + final String? brandingDarkImage = _checkImageExists(config: config, parameter: 'branding_dark'); final String? color = parseColor(config['color']); - String? darkColor = parseColor(config['color_dark']); + final String? darkColor = parseColor(config['color_dark']); final String? backgroundImage = _checkImageExists(config: config, parameter: 'background_image'); - String? darkBackgroundImage = + final String? darkBackgroundImage = _checkImageExists(config: config, parameter: 'background_image_dark'); - if (darkImage == null && darkColor == null) { - if (image != null) { - darkImage = image; - } else { - darkColor = color; - } - brandingDarkImage = brandingImage; - darkBackgroundImage = backgroundImage; - } final plistFiles = config['info_plist_files'] as List?; String gravity = (config['fill'] as bool? ?? false) ? 'fill' : 'center'; @@ -92,13 +83,11 @@ void createSplashByConfig(Map config) { android12Image = _checkImageExists(config: android12Config, parameter: 'image'); android12DarkImage = - _checkImageExists(config: android12Config, parameter: 'image_dark') ?? - android12Image; + _checkImageExists(config: android12Config, parameter: 'image_dark'); android12IconBackgroundColor = parseColor(android12Config['icon_background_color']); darkAndroid12IconBackgroundColor = - parseColor(android12Config['icon_background_color_dark']) ?? - android12IconBackgroundColor; + parseColor(android12Config['icon_background_color_dark']); android12Color = parseColor(android12Config['color']) ?? color; android12DarkColor = parseColor(android12Config['dark_color']) ?? darkColor; } diff --git a/lib/ios.dart b/lib/ios.dart index 11a4cf3..a552e61 100644 --- a/lib/ios.dart +++ b/lib/ios.dart @@ -136,7 +136,7 @@ void _createiOSSplash({ ); } - _applyLaunchScreenStoryboard( + _createLaunchScreenStoryboard( imagePath: imagePath, brandingImagePath: brandingImagePath, iosContentMode: iosContentMode, @@ -206,42 +206,6 @@ void _saveImageiOS({ file.writeAsBytesSync(encodePng(newFile)); } -/// Update LaunchScreen.storyboard adding width, height and color -void _applyLaunchScreenStoryboard({ - required String? imagePath, - required String iosContentMode, - String? iosBrandingContentMode, - String? brandingImagePath, -}) { - final file = File(_flavorHelper.iOSLaunchScreenStoryboardFile); - - if (file.existsSync()) { - print( - '[iOS] Updating ${_flavorHelper.iOSLaunchScreenStoryboardName}.storyboard with width, and height', - ); - return _updateLaunchScreenStoryboard( - imagePath: imagePath, - brandingImagePath: brandingImagePath, - iosContentMode: iosContentMode, - iosBrandingContentMode: iosBrandingContentMode, - ); - } else { - print( - '[iOS] No ${_flavorHelper.iOSLaunchScreenStoryboardName}.storyboard file found in your iOS project', - ); - print( - '[iOS] Creating ${_flavorHelper.iOSLaunchScreenStoryboardName}.storyboard file and adding it ' - 'to your iOS project', - ); - return _createLaunchScreenStoryboard( - imagePath: imagePath, - brandingImagePath: brandingImagePath, - iosContentMode: iosContentMode, - iosBrandingContentMode: iosBrandingContentMode, - ); - } -} - /// Updates LaunchScreen.storyboard adding splash image path void _updateLaunchScreenStoryboard({ required String? imagePath, @@ -430,8 +394,8 @@ void _updateLaunchScreenStoryboard({ void _createLaunchScreenStoryboard({ required String? imagePath, required String iosContentMode, - String? iosBrandingContentMode, - String? brandingImagePath, + required String? iosBrandingContentMode, + required String? brandingImagePath, }) { final file = File(_flavorHelper.iOSLaunchScreenStoryboardFile); file.createSync(recursive: true); diff --git a/pubspec.yaml b/pubspec.yaml index c19821b..83df24a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.2 +version: 2.2.3 homepage: https://github.com/jonbhanson/flutter_native_splash environment: @@ -20,7 +20,7 @@ dependencies: meta: ^1.7.0 path: ^1.8.1 universal_io: ^2.0.4 - xml: ^6.0.1 + xml: ^6.1.0 yaml: ^3.1.1 dev_dependencies: