Skip to content

Commit b957d08

Browse files
committed
Remove v31/styles.xml files if not in use. Fixes #514. Remove web changes on remove command. Fixes #516.
1 parent d67647b commit b957d08

File tree

6 files changed

+50
-10
lines changed

6 files changed

+50
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.2.18] - (2023-Feb-19)
2+
- Remove `v31/styles.xml` files if not in use. Fixes [#514](https://github.com/jonbhanson/flutter_native_splash/issues/514).
3+
- Remove web changes on `remove` command. Fixes [#516](https://github.com/jonbhanson/flutter_native_splash/issues/516).
4+
15
## [2.2.17] - (2023-Jan-15)
26
- Updated image dependency to v4.0.10. Fixes [#497](https://github.com/jonbhanson/flutter_native_splash/issues/497).
37
- Changed image processing from linear to cubic to improve image quality. Fixes [#472](https://github.com/jonbhanson/flutter_native_splash/issues/472).

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.
1919

2020
```yaml
2121
dependencies:
22-
flutter_native_splash: ^2.2.17
22+
flutter_native_splash: ^2.2.18
2323
```
2424
2525
Don't forget to `flutter pub get`.
@@ -230,7 +230,7 @@ Be aware of the following considerations regarding these elements:
230230

231231
4. `color` the window background consists of a single opaque color.
232232

233-
~~**_PLEASE NOTE:_** The splash screen may not appear when you launch the app from Android Studio. However, it should appear when you launch by clicking on the launch icon in Android.~~ This seems to be resolved now.
233+
**_PLEASE NOTE:_** The splash screen may not appear when you launch the app from Android Studio on API 31. However, it should appear when you launch by clicking on the launch icon in Android. This seems to be resolved in API 32+.
234234

235235
**_PLEASE NOTE:_** There are a number of reports that non-Google launchers do not display the launch image correctly. If the launch image does not display correctly, please try the Google launcher to confirm that this package is working.
236236

example/pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages:
1414
name: args
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.3.1"
17+
version: "2.4.0"
1818
async:
1919
dependency: transitive
2020
description:
@@ -96,7 +96,7 @@ packages:
9696
path: ".."
9797
relative: true
9898
source: path
99-
version: "2.2.17"
99+
version: "2.2.18"
100100
flutter_test:
101101
dependency: "direct dev"
102102
description: flutter
@@ -120,7 +120,7 @@ packages:
120120
name: image
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "4.0.10"
123+
version: "4.0.15"
124124
js:
125125
dependency: transitive
126126
description:
@@ -230,7 +230,7 @@ packages:
230230
name: universal_io
231231
url: "https://pub.dartlang.org"
232232
source: hosted
233-
version: "2.0.4"
233+
version: "2.2.0"
234234
vector_math:
235235
dependency: transitive
236236
description:

lib/android.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ void _createAndroidSplash({
184184
android12IconBackgroundColor: android12IconBackgroundColor,
185185
android12BrandingImagePath: android12BrandingImagePath,
186186
);
187+
} else {
188+
File file = File(_flavorHelper.androidV31StylesFile);
189+
if (file.existsSync()) file.deleteSync();
187190
}
188191

189192
if (android12DarkBackgroundColor != null ||
@@ -199,6 +202,9 @@ void _createAndroidSplash({
199202
android12IconBackgroundColor: darkAndroid12IconBackgroundColor,
200203
android12BrandingImagePath: android12DarkBrandingImagePath,
201204
);
205+
} else {
206+
File file = File(_flavorHelper.androidV31StylesNightFile);
207+
if (file.existsSync()) file.deleteSync();
202208
}
203209

204210
_applyStylesXml(

lib/web.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,36 @@ void _createWebSplash({
2626
return;
2727
}
2828

29+
// Config for removing splash screen:
30+
if (imagePath == null &&
31+
darkImagePath == null &&
32+
color == "ffffff" &&
33+
darkColor == "000000" &&
34+
brandingImagePath == null &&
35+
brandingDarkImagePath == null &&
36+
backgroundImage == null &&
37+
darkBackgroundImage == null) {
38+
Directory splashFolder = Directory(_webSplashFolder);
39+
if (splashFolder.existsSync()) splashFolder.deleteSync(recursive: true);
40+
final webIndex = File(_webIndex);
41+
final document = html_parser.parse(webIndex.readAsStringSync());
42+
// Remove items that may have been added to index.html:
43+
document
44+
.querySelector(
45+
'link[rel="stylesheet"][type="text/css"][href="splash/style.css"]')
46+
?.remove();
47+
document
48+
.querySelector(
49+
'meta[content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"][name="viewport"]',
50+
)
51+
?.remove();
52+
document.querySelector('script[src="splash/splash.js"]')?.remove();
53+
document.querySelector('picture#splash')?.remove();
54+
document.querySelector('picture#splash-branding')?.remove();
55+
webIndex.writeAsStringSync(document.outerHtml);
56+
return;
57+
}
58+
2959
darkImagePath ??= imagePath;
3060
_createWebImages(
3161
imagePath: imagePath,

pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_native_splash
22
description: Customize Flutter's default white native splash screen with
33
background color and splash image. Supports dark mode, full screen, and more.
4-
version: 2.2.17
4+
version: 2.2.18
55
repository: https://github.com/jonbhanson/flutter_native_splash
66
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues
77

@@ -10,17 +10,17 @@ environment:
1010
flutter: ">=2.5.0"
1111

1212
dependencies:
13-
args: ^2.3.1
13+
args: ^2.4.0
1414
flutter:
1515
sdk: flutter
1616
flutter_web_plugins:
1717
sdk: flutter
1818
js: ^0.6.4
1919
html: ^0.15.1
20-
image: ^4.0.10
20+
image: ^4.0.15
2121
meta: ^1.8.0
2222
path: ^1.8.2
23-
universal_io: ^2.0.4
23+
universal_io: ^2.2.0
2424
xml: ^6.1.0
2525
yaml: ^3.1.1
2626

0 commit comments

Comments
 (0)