How do I show a splash Screen in flutter? So there is an option for launch icon. I added images for ios and android in their respective folders. My problem is it is too fast. So it directly opens MyApp(). I want my app to not show anything and let splash take control until I figure out which screen to take the user to (In MyApp I want to do intialization)
To do so, open the Flutter app's Xcode project by typing open ios/Runner. xcworkspace from the root of your app directory. Then select Runner/Assets. xcassets from the Project Navigator and drop in the desired images to the LaunchImage image set.
A splash screen is a launch screen, start screen, or boot screen, which is a graphical control element containing the image, logo, and current version of the software. It is the first screen of the app that displays whenever the application is loading.
You can use Future.delayed
constructor in your initState
. This will keep your SplashScreen for the duration you specify before the navigation happen.
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => new _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState (){
super.initState();
// TODO initial state stuff
new Future.delayed(const Duration(seconds: 4));
}
@override
Widget build(BuildContext context) {
//build
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With