Mikel Tawfik
Mikel Tawfik

Reputation: 746

remove default splash screen android & ios flutter

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

Upvotes: 15

Views: 51514

Answers (4)

Mahabub Alam Shawon
Mahabub Alam Shawon

Reputation: 39

In android go to app -> main -> res -> values -> styles.xml and leave it like this:

Add this line

**<item name="android:windowIsTranslucent">true</item>**

Full Code

enter image description here

Upvotes: 2

Abir Ahsan
Abir Ahsan

Reputation: 3049

For iOS: Open your ios/Runner/Info.plist file and look for the key UILaunchStoryboardName.

Set its value to an empty string or remove the key altogether:

<key>UILaunchStoryboardName</key>
<string></string>

Upvotes: 0

Ashnet
Ashnet

Reputation: 428

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>

Upvotes: 4

Abion47
Abion47

Reputation: 24726

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.

Upvotes: 17

Related Questions