Skip to content

Commit 18027f5

Browse files
committed
Remove white flash on web. Thanks eggp for pointing out the problem and solution. Closes #607.
1 parent 4014482 commit 18027f5

5 files changed

Lines changed: 22 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.3.5] - (2023-Oct-29)
2+
3+
- Remove white flash on web. Thanks [eggp](https://github.com/eggp) for pointing out the problem and solution. Closes [#607](https://github.com/jonbhanson/flutter_native_splash/issues/607).
4+
15
## [2.3.4] - (2023-Oct-16)
26

37
- Use `average` for image interpolation to reduce aliasing. Thanks [Shawn](https://github.com/esDotDev) for the tip. Fixes [#598](https://github.com/jonbhanson/flutter_native_splash/issues/598).

README.md

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

2222
```yaml
2323
dependencies:
24-
flutter_native_splash: ^2.3.4
24+
flutter_native_splash: ^2.3.5
2525
```
2626
2727
Don't forget to `flutter pub get`.
@@ -133,8 +133,10 @@ flutter_native_splash:
133133
#background_image_dark_web: "assets/dark-background-web.png"
134134
#branding_android: assets/brand-android.png
135135
#branding_dark_android: assets/dart_dark-android.png
136-
#branding_ios: assets/brand-ios.gif
137-
#branding_dark_ios: assets/dart_dark-ios.gif
136+
#branding_ios: assets/brand-ios.png
137+
#branding_dark_ios: assets/dart_dark-ios.png
138+
#branding_web: assets/brand-web.gif
139+
#branding_dark_web: assets/dart_dark-web.gif
138140
139141
# The position of the splash image can be set with android_gravity, ios_content_mode, and
140142
# web_image_mode parameters. All default to center.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ packages:
116116
path: ".."
117117
relative: true
118118
source: path
119-
version: "2.3.3"
119+
version: "2.3.5"
120120
flutter_test:
121121
dependency: "direct dev"
122122
description: flutter

lib/flutter_native_splash.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
library flutter_native_splash;
88

99
import 'package:flutter/foundation.dart';
10+
import 'package:flutter/scheduler.dart';
1011
import 'package:flutter/services.dart';
1112
import 'package:flutter/widgets.dart';
1213

@@ -48,13 +49,16 @@ class FlutterNativeSplash {
4849
_widgetsBinding?.allowFirstFrame();
4950
_widgetsBinding = null;
5051
if (kIsWeb) {
51-
try {
52-
_channel.invokeMethod('remove');
53-
} catch (e) {
54-
throw Exception(
55-
'$e\nDid you forget to run "dart run flutter_native_splash:create"?',
56-
);
57-
}
52+
// Use SchedulerBinding to avoid white flash on splash removal.
53+
SchedulerBinding.instance.addPostFrameCallback((_) {
54+
try {
55+
_channel.invokeMethod('remove');
56+
} catch (e) {
57+
throw Exception(
58+
'$e\nDid you forget to run "dart run flutter_native_splash:create"?',
59+
);
60+
}
61+
});
5862
}
5963
}
6064
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
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.3.4
4+
version: 2.3.5
55
repository: https://github.com/jonbhanson/flutter_native_splash
66
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues
77

0 commit comments

Comments
 (0)