diff --git a/CHANGELOG.md b/CHANGELOG.md index bb79423..0b5d487 100644 --- a/CHANGELOG.md +++ b/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). diff --git a/README.md b/README.md index 3bf8787..a0254cd 100644 --- a/README.md +++ b/README.md @@ -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`. @@ -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. diff --git a/example/pubspec.lock b/example/pubspec.lock index 0623ad7..bd9b5e7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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 diff --git a/lib/flutter_native_splash.dart b/lib/flutter_native_splash.dart index b17f456..a3f3bc9 100644 --- a/lib/flutter_native_splash.dart +++ b/lib/flutter_native_splash.dart @@ -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'; @@ -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"?', + ); + } + }); } } } diff --git a/pubspec.yaml b/pubspec.yaml index 7b8f3ef..42d0ace 100644 --- a/pubspec.yaml +++ b/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