Home > database >  how to increase Flutter launch_background.xml Splash Screen display time?
how to increase Flutter launch_background.xml Splash Screen display time?

Time:10-23

I've trying to run my app in debug mode, but my app was laggy and didn't get 60fps. Then i'm trying to run my app in release mode with

flutter run --release

And i got 60 fps, but i got my image in launch_background.xml as Splash Screen disappearing too fast. How to increase the display time, maybe 3 until 5 seconds, like in debug mode ?

Do me a favor please...

CodePudding user response:

You can't calculate the exact time, It depends on the hardware and platform the application is running on it.

Flutter takes some time to render and this time is different for different devices.

But you can put a delay just before the runApp function, if you need to show the splash screen longer than flutter rendering time. like this:

void main() async {//make your main function async
  //put delay here with await:
  await Future.delayed(Duration(seconds: 3));

  runApp(MyApp());
  //total splash time = your delay   the time that Flutter needs to render
}
  • Related