jonbhanson / flutter_native_splash

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.
https://pub.dev/packages/flutter_native_splash
MIT License
1.36k stars 215 forks source link

On iOS, when native splash screen is visible, Flutter can receive gesture events. #665

Closed vincendep closed 9 months ago

vincendep commented 9 months ago

On iOS is possible to interact with Flutter UI when the native splash screen is still visible.

To Reproduce

import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:url_launcher/url_launcher.dart';

final Uri _url = Uri.parse('https://flutter.dev');

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  runApp(
     GestureDetector(
      onTap: _launchUrl,
      child: const MaterialApp(home: Material()),
    ),
  );
}

Future<void> _launchUrl() async {
  if (!await launchUrl(_url)) {
    throw Exception('Could not launch $_url');
  }
}

https://github.com/jonbhanson/flutter_native_splash/assets/37916223/74d4706b-f2ee-413f-aa0a-a7d4dfec418e

jonbhanson commented 9 months ago

That is very interesting. However, this package only configures the appearance of the splash screen (command line util) and controls when it is removed (with the .remove method). This behavior would have to be addressed by the Flutter team. Or it might even be iOS related.

vincendep commented 9 months ago

I was suspecting it...I guess it should be addressed by the flutter team then