'Extend splash screen loading time

I have a splash screen when loading my app. I implemented an auto-login system in my app, I've tried to re-create splash screen using Container. But whenever the splash screen finishes loading, I can see the container blink because it switches to the Container from Splash screen and it doesn't look nice at all. Are there any ways I could "extend" splash screen loading instead of using re-created container for it?

I am using this package for splash screen https://pub.dev/packages/flutter_native_splash

main.dart

  home: FutureBuilder(
              future: _autoLogin,
              builder: (BuildContext context, snapshot) {
                if (snapshot.connectionState == ConnectionState.waiting) {
                 //Recreated splash screen
                  return Center(
                    child: Container(
                      width: 213.0,
                      height: 121.0,
                      decoration: const BoxDecoration(
                          color: Colors.black,
                          image: DecorationImage(
                              image: AssetImage("assets/images/splash.png"),
                              fit: BoxFit.contain)),
                    ),
                  );
                }
                if (snapshot.connectionState == ConnectionState.done) {
                  if (snapshot.hasData && snapshot.data == true) {
                    return const HomePage();
                  }
                }
                return Onboarding();
              }),


Solution 1:[1]

You could try to perform your 'auto login' procedure in the main method before calling runApp function. That way the Splash screen will be presented until you call the function.

Note: it is good to have some timeout logic, that way the user won't think the app hangs when opened if the auto-login takes more time than expected.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stoyan Milev