Skip to content

Commit

Permalink
flutter_native_splash:remove adheres to android/ios/web setting. Fixes
Browse files Browse the repository at this point in the history
…#159.  Updated readme images.
  • Loading branch information
jonbhanson committed Apr 2, 2021
1 parent 0fd272f commit 7e75baf
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 11 deletions.
5 changes: 5 additions & 0 deletions 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).
Expand Down
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -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.

<p align='center'>
<video autoplay muted="true" loop="true">
<source src="https://raw.githubusercontent.com/jonbhanson/flutter_native_splash/master/ios.mp4" type="video/webm">
<img src="https://raw.githubusercontent.com/jonbhanson/flutter_native_splash/master/splash_demo.gif" width="250" height="443" />
</video>
<img src="splash_demo.gif" />
<img src="splash_demo_dark.gif" />
</p>

# Usage
Expand All @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Expand Up @@ -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
Expand All @@ -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:
Expand Down
20 changes: 17 additions & 3 deletions lib/supported_platform.dart
Expand Up @@ -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 = <String, dynamic>{'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(
Expand Down Expand Up @@ -151,7 +164,10 @@ Map<String, dynamic> getConfig({String? configFile}) {
config[entry.key] = entry.value;
}
}
return config;
}

void checkConfig(Map<String, dynamic> config) {
if (config.containsKey('color') && config.containsKey('background_image')) {
print('Your `flutter_native_splash` section cannot not contain both a '
'`color` and `background_image`.');
Expand All @@ -178,6 +194,4 @@ Map<String, dynamic> getConfig({String? configFile}) {
'does not contain a `color_dark` or a `background_image_dark`.');
exit(1);
}

return config;
}
2 changes: 1 addition & 1 deletion 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:
Expand Down
Binary file modified splash_demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added splash_demo_dark.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7e75baf

Please sign in to comment.