Skip to content

Commit

Permalink
Don't update values-31 if there is no android_12 section in the config.
Browse files Browse the repository at this point in the history
Closes #447.

Additional fix for index.html getting extra blank lines. Fixes #430.
  • Loading branch information
jonbhanson committed Nov 6, 2022
1 parent a91dc4b commit 0239914
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## [2.2.14] - (2022-Nov-07)

- Don't update `values-31` if there is no `android_12` section in the config. Closes [#447](https://github.com/jonbhanson/flutter_native_splash/issues/447).
- Additional fix for index.html getting extra blank lines. Fixes [#430](https://github.com/jonbhanson/flutter_native_splash/issues/430).

## [2.2.13] - (2022-Oct-30)

- Corrected Android 12 dark parameters not defaulting to light parameters. Thanks [elliotrtd](https://github.com/elliotrtd) for the [heads up](https://github.com/jonbhanson/flutter_native_splash/issues/400#issuecomment-1235100173) on this issue.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.

```yaml
dependencies:
flutter_native_splash: ^2.2.13
flutter_native_splash: ^2.2.14
```

Don't forget to `flutter pub get`.
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.lock
Expand Up @@ -96,7 +96,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.2.10"
version: "2.2.14"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -113,14 +113,14 @@ packages:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
version: "0.15.1"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.2"
js:
dependency: transitive
description:
Expand Down
23 changes: 14 additions & 9 deletions lib/android.dart
Expand Up @@ -171,15 +171,20 @@ void _createAndroidSplash({
}

print('[Android] Updating styles...');
_applyStylesXml(
fullScreen: fullscreen,
file: _flavorHelper.androidV31StylesFile,
template: _androidV31StylesXml,
android12BackgroundColor: android12BackgroundColor,
android12ImagePath: android12ImagePath,
android12IconBackgroundColor: android12IconBackgroundColor,
android12BrandingImagePath: android12BrandingImagePath,
);
if (android12BackgroundColor != null ||
android12ImagePath != null ||
android12IconBackgroundColor != null ||
android12BrandingImagePath != null) {
_applyStylesXml(
fullScreen: fullscreen,
file: _flavorHelper.androidV31StylesFile,
template: _androidV31StylesXml,
android12BackgroundColor: android12BackgroundColor,
android12ImagePath: android12ImagePath,
android12IconBackgroundColor: android12IconBackgroundColor,
android12BrandingImagePath: android12BrandingImagePath,
);
}

if (android12DarkBackgroundColor != null ||
android12DarkImagePath != null ||
Expand Down
6 changes: 2 additions & 4 deletions lib/templates.dart
Expand Up @@ -501,18 +501,16 @@ body {
}
''';

// XML's insertBefore needs a blank line at the start and not newline at the end:
// XML's insertBefore can't have a newline at the end:
const String _indexHtmlPicture = '''
<picture id="splash">
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x" media="(prefers-color-scheme: dark)">
<img class="[IMAGEMODE]" aria-hidden="true" src="splash/img/light-1x.png" alt=""/>
</picture>''';

// XML's insertBefore needs a blank line at the start and not newline at the end:
// XML's insertBefore can't have a newline at the end:
const String _indexHtmlBrandingPicture = '''
<picture id="splash-branding">
<source srcset="splash/img/branding-1x.png 1x, splash/img/branding-2x.png 2x, splash/img/branding-3x.png 3x, splash/img/branding-4x.png 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/branding-dark-1x.png 1x, splash/img/branding-dark-2x.png 2x, splash/img/branding-dark-3x.png 3x, splash/img/branding-dark-4x.png 4x" media="(prefers-color-scheme: dark)">
Expand Down
2 changes: 1 addition & 1 deletion 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.13
version: 2.2.14
repository: https://github.com/jonbhanson/flutter_native_splash
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues

Expand Down

0 comments on commit 0239914

Please sign in to comment.