Skip to content

Commit

Permalink
Remove white flash on web. Thanks eggp for pointing out the problem a…
Browse files Browse the repository at this point in the history
…nd solution. Closes #607.
  • Loading branch information
jonbhanson committed Oct 29, 2023
1 parent 4014482 commit 18027f5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## [2.3.5] - (2023-Oct-29)

- 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).

## [2.3.4] - (2023-Oct-16)

- 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).
Expand Down
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -21,7 +21,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.

```yaml
dependencies:
flutter_native_splash: ^2.3.4
flutter_native_splash: ^2.3.5
```

Don't forget to `flutter pub get`.
Expand Down Expand Up @@ -133,8 +133,10 @@ flutter_native_splash:
#background_image_dark_web: "assets/dark-background-web.png"
#branding_android: assets/brand-android.png
#branding_dark_android: assets/dart_dark-android.png
#branding_ios: assets/brand-ios.gif
#branding_dark_ios: assets/dart_dark-ios.gif
#branding_ios: assets/brand-ios.png
#branding_dark_ios: assets/dart_dark-ios.png
#branding_web: assets/brand-web.gif
#branding_dark_web: assets/dart_dark-web.gif

# The position of the splash image can be set with android_gravity, ios_content_mode, and
# web_image_mode parameters. All default to center.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Expand Up @@ -116,7 +116,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.3.3"
version: "2.3.5"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
18 changes: 11 additions & 7 deletions lib/flutter_native_splash.dart
Expand Up @@ -7,6 +7,7 @@
library flutter_native_splash;

import 'package:flutter/foundation.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

Expand Down Expand Up @@ -48,13 +49,16 @@ class FlutterNativeSplash {
_widgetsBinding?.allowFirstFrame();
_widgetsBinding = null;
if (kIsWeb) {
try {
_channel.invokeMethod('remove');
} catch (e) {
throw Exception(
'$e\nDid you forget to run "dart run flutter_native_splash:create"?',
);
}
// Use SchedulerBinding to avoid white flash on splash removal.
SchedulerBinding.instance.addPostFrameCallback((_) {
try {
_channel.invokeMethod('remove');
} catch (e) {
throw Exception(
'$e\nDid you forget to run "dart run flutter_native_splash:create"?',
);
}
});
}
}
}
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.3.4
version: 2.3.5
repository: https://github.com/jonbhanson/flutter_native_splash
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues

Expand Down

0 comments on commit 18027f5

Please sign in to comment.