The Animated Splash screen is used for a startup screen in a Flutter application. More or less all applications use them generally to show the logo of the institution and its creators awareness. This although holds no functionality but it can be great to increase product awareness and promotion.
Let’s look deep into the implementation of the Animated Splash screen with the help of a simple application. To build so, follow the below steps:
- Add the dependency in pubspec.yaml file
- Import the dependency to the main.dart file
- Add the asset (logo) to the asset folder for use in the application
- Add the asset to the pubspec.yaml file
- Create the Homepage for which to transition after the splash screen
Now, let’s look into the steps in detail.
Adding the Dependency:
The animated_splash dependency can be added to the pubspec.yaml file as shown below:
Importing the Dependency:
To import the animated_splash dependency to the main.dart file, use the following line of code:
Activating the Asset:
To use the logo image, the assets need to be added to the assets path as shown below:
Adding the logo:
Create an assets directory inside the root directory of the project. Inside the logo that you want to use inside the assets directory as shown below:
Creating the Homepage:
Make use of the StatefulWidget that extends to an appbar and a body. We will also create a dummy function to delay the screen time of the logo. The function can be something like as shown below:
Now to structure the application extent the StatefulWidget to Homepage as shown below:
Complete Source Code:
- How to Create an Animated Splash Screen in Android?
- Splash Screen in Flutter
- Android | Creating a Splash Screen
- How to Create a Splash Screen in Android using Kotlin?
- Flutter - Send Data to Screen
- Flutter - Return Data from Screen
- Flutter - Send Data to Screen using RouteSettings
- Android | Creating multiple Screen app
- How to scale different Views to all screen sizes in Android Studio?
- Screen Orientations in Android with Examples
- Screen Pinning
- Locking Screen Orientation in Android
- How to Keep the Device Screen On in Android?
- How to Increase/Decrease Screen Brightness in Steps Programmatically in Android?
- How to Increase/Decrease Screen Brightness using Volume Keys Programmatically in Android?
- How to Detect Touch Event on Screen Programmatically in Android?
- How to Find the Screen Resolution of a Device Programmatically in Android?
- How to Change the Screen Orientation Programmatically using a Button in Android?
- How to Align Navigation Drawer and its Elements towards the Left or Right of the Screen in Android?
- How to Maximize/Minimize Screen Brightness Programmatically in Android?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.