颤振开始徽标

时间:2020-06-11 15:25:15

标签: android ios flutter

在加载的那几秒钟内,如何在应用启动时显示徽标?

例如,

FB显示如下:

fb example

1 个答案:

答案 0 :(得分:2)

只需添加具有延迟功能的小部件

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),
        ));
  }
}