Skip to content

Commit 600c3e1

Browse files
authored
Merge pull request #136 from flutter-news-app-full-source-code/Fix/web-splash-remover
Fix/web splash remover
2 parents adff20e + 861e018 commit 600c3e1

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.2.1
4+
5+
- **Fix:** Resolved an issue where the web splash screen would not disappear after the application loaded due to an incorrect bootstrap script in `index.html`.
6+
37
## 1.2.0
48

59
- **Refactor:** Updated `flutter_launcher_icons` configurations.

lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ void main() async {
1919

2020
// Only remove the splash screen on web after the app is ready.
2121
if (kIsWeb) {
22-
removeSplashFromWeb();
22+
WidgetsBinding.instance.addPostFrameCallback((_) {
23+
removeSplashFromWeb();
24+
});
2325
}
2426

2527
if (appConfig.environment == AppEnvironment.demo && kIsWeb) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_news_app_mobile_client_full_source_code
22
description: Complete, production-ready source code for a feature-rich Flutter news app mobile client.
3-
version: 1.2.0
3+
version: 1.2.1
44
publish_to: none
55
repository: https://github.com/flutter-news-app-full-source-code/flutter-news-app-mobile-client-full-source-code
66
homepage: https://flutter-news-app-full-source-code.github.io/docs/

web/index.html

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
document.body.style.background = "transparent";
116116
}
117117
</script>
118+
<script>
119+
var serviceWorkerVersion = null;
120+
</script>
121+
<script src="flutter.js" defer></script>
118122
</head>
119123

120124
<body>
@@ -132,12 +136,20 @@
132136
<div class="loader"></div>
133137
</div>
134138
<script>
135-
{ { flutter_bootstrap_js } }
139+
window.addEventListener('load', function (ev) {
140+
// Download main.dart.js
141+
_flutter.loader.loadEntrypoint({
142+
serviceWorker: {
143+
serviceWorkerVersion: serviceWorkerVersion,
144+
},
145+
onEntrypointLoaded: function (engineInitializer) {
146+
engineInitializer.initializeEngine().then(function (appRunner) {
147+
appRunner.runApp();
148+
});
149+
}
150+
});
151+
});
136152
</script>
137-
138-
139-
140-
141153
</body>
142154

143-
</html>
155+
</html>

0 commit comments

Comments
 (0)