Pubspec.YAML code-
flutter_native_splash: ^2.0.1 1
flutter_native_splash:
image: assets/images/splashScreen.png
color: "#c988be"
Styles.xml -
style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">true</item>
</style>
CodePudding user response:
if you want to hide the action bar you need to go to app manifests and then set the theme of the splash screen layout to no action bar as so:
android:theme="@style/Theme.AppCompat.NoActionBar"
if you want also to hide the status bar you use flags in the splash screen activity as so:
@Suppress("DEPRECATION")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.hide(WindowInsets.Type.statusBars())
}else{
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
}
CodePudding user response:
You have to check this package flutter_native_splash, in this package you just need to set your splash screen image path.
Add this code into your pubspec.yaml file
flutter_native_splash:
background_image: "assets/images/splash_bg.png"
Make sure to run this command:
flutter pub run flutter_native_splash:create