0

how can I show a logo at app start, during those few seconds of loading?

FB, for example, shows this:

fb example

Lorenzo Tosone
  • 393
  • 3
  • 10
  • 4
    Does this answer your question? [Adding a splash screen to Flutter apps](https://stackoverflow.com/questions/43879103/adding-a-splash-screen-to-flutter-apps) – Alpana Jun 11 '20 at 15:34
  • Link to Flutter developer documentation: https://flutter.dev/docs/development/ui/advanced/splash-screen – Alpana Jun 11 '20 at 15:36
  • 1
    you can check here https://stackoverflow.com/questions/54575622/splash-screen-implementation-in-flutter – Shalu T D Jun 11 '20 at 15:38

1 Answers1

2

Just add a widget with delay function

void main() {
  runApp(DisplayLogo());
}

class DisplayLogo extends StatefulWidget {
  @override
  _State createState() => _State();
}

class _State extends State<DisplayLogo> {
  initState() {
    super.initState();
    ///add delay here
    Timer(Duration(seconds: 2), () {
     if(mounted)
      runApp(MainApp());
    });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.white,
        child: Center(
          child: FlutterLogo(size: 300),
        ));
  }
}
Anirudh Sharma
  • 657
  • 7
  • 19