i preferred use custom splash screen that's allow me to build whole page . so , am trying to remove default splash from android and ios
void main() async {
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
runApp(MaterialApp(
title: 'Navigation Basics',
debugShowCheckedModeBanner: false,
home: new SplashPage(),
routes: {
// When navigating to the "/" route, build the FirstScreen widget.
'/home': (BuildContext context) => new FirstRoute(),
},
));
}
class SplashPage extends StatefulWidget {
@override
SplashPageState createState() => SplashPageState();
}
class SplashPageState extends State<SplashPage> {
void navigationToNextPage() {
Navigator.pushNamed(context, '/home');
}
startSplashScreenTimer() async {
var _duration = new Duration(seconds: 5);
return new Timer(_duration, navigationToNextPage);
}
@override
void initState() {
super.initState();
startSplashScreenTimer();
}
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIOverlays([]);
return Container(
child: new Image.asset('images/banner.png', fit: BoxFit.fill));
}
}
so i need to remove default splash screen from both with flutter
The default splash screen cannot be overridden with Dart/Flutter alone. They are controls shown by the native Android/iOS context while the Flutter runtime is initializing. As such, any splash screen widget you create inside Flutter will show after the default splash screen. (Even if you completely remove the default splash image, the app would just be a blank while screen until Flutter finished loading, and that's bad design.)
There are instructions on how to change the default splash screen here. If you are well-versed in native Android or iOS development, you could take it a step further than just a simple image if you wanted.
You can do it by ignoring adding a launcher icon.
In android go to app -> main -> res -> drawable -> launch_background.xml and leave it like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item> -->
</layer-list>
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