diff --git a/CHANGELOG.md b/CHANGELOG.md index 243c48f..d3ff0f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.1.7] - (2021-Apr-02) + +* flutter_native_splash:remove adheres to android/ios/web setting. Fixes [#159](https://github.com/jonbhanson/flutter_native_splash/issues/159). +* Updated readme images. + ## [1.1.6+1] - (2021-Mar-29) * Corrected Android scaling. Thanks [@chris-efission](https://github.com/chris-efission). diff --git a/README.md b/README.md index 53fd6d5..fd0007c 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,8 @@ When your app is opened, there is a brief time while the native app loads Flutter. By default, during this time the native app displays a white splash screen. This package automatically generates iOS, Android, and Web native code for customizing this native splash screen background color and splash image. Supports dark mode, full screen, and platform-specific options.

- + +

# Usage @@ -19,7 +17,7 @@ First, add `flutter_native_splash` as a dev dependency in your pubspec.yaml file ```yaml dev_dependencies: - flutter_native_splash: ^1.1.6+1 + flutter_native_splash: ^1.1.7 ``` Don't forget to `flutter pub get`. diff --git a/example/pubspec.lock b/example/pubspec.lock index 06e128e..24d343f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -82,7 +82,7 @@ packages: path: ".." relative: true source: path - version: "1.1.1" + version: "1.1.7" flutter_test: dependency: "direct dev" description: flutter @@ -94,7 +94,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" matcher: dependency: transitive description: diff --git a/lib/supported_platform.dart b/lib/supported_platform.dart index 0ee9f57..4ae5854 100644 --- a/lib/supported_platform.dart +++ b/lib/supported_platform.dart @@ -24,13 +24,26 @@ part 'web.dart'; /// Function that will be called on supported platforms to create the splash screens. void tryCreateSplash() { var config = getConfig(); + checkConfig(config); tryCreateSplashByConfig(config); } /// Function that will be called on supported platforms to remove the splash screens. void tryRemoveSplash() { print('Restoring Flutter\'s default white native splash screen...'); - tryCreateSplashByConfig({'color': '#ffffff'}); + var config = getConfig(); + + var removeConfig = {'color': '#ffffff'}; + if (config.containsKey('android')) { + removeConfig['android'] = config['android']; + } + if (config.containsKey('ios')) { + removeConfig['ios'] = config['ios']; + } + if (config.containsKey('web')) { + removeConfig['web'] = config['web']; + } + tryCreateSplashByConfig(removeConfig); } String checkImageExists( @@ -151,7 +164,10 @@ Map getConfig({String? configFile}) { config[entry.key] = entry.value; } } + return config; +} +void checkConfig(Map config) { if (config.containsKey('color') && config.containsKey('background_image')) { print('Your `flutter_native_splash` section cannot not contain both a ' '`color` and `background_image`.'); @@ -178,6 +194,4 @@ Map getConfig({String? configFile}) { 'does not contain a `color_dark` or a `background_image_dark`.'); exit(1); } - - return config; } diff --git a/pubspec.yaml b/pubspec.yaml index c3fa09c..0087e4b 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.6+1 +version: 1.1.7 homepage: https://github.com/jonbhanson/flutter_native_splash environment: diff --git a/splash_demo.gif b/splash_demo.gif index 3ef57bf..a89749c 100644 Binary files a/splash_demo.gif and b/splash_demo.gif differ diff --git a/splash_demo_dark.gif b/splash_demo_dark.gif new file mode 100644 index 0000000..b09f7ca Binary files /dev/null and b/splash_demo_dark.gif differ