From 9f8cf92e70283b5585c790ffa7da5740a9052a7b Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 14 Apr 2021 14:19:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8=20fire=20base=20=E5=B9=B6?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/splash/splash_page.dart | 12 ++++++++++-- pubspec.yaml | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index 99cf8e2..e571965 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -7,6 +7,7 @@ import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/utils/dev_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:dio/dio.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -44,6 +45,8 @@ class _SplashPageState extends State { await Permission.locationWhenInUse.request(); } + final Future _initialization = Firebase.initializeApp(); + Future _initOp() async { await _originOp(); final appProvider = Provider.of(context, listen: false); @@ -65,8 +68,13 @@ class _SplashPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - body: Center( - child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP), + body: FutureBuilder( + future: _initialization, + builder: (context, snapshot) { + return Center( + child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP), + ); + }, ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 5c8bc92..571de48 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,6 +56,7 @@ dependencies: #谷歌崩溃分析 firebase_core: ^1.0.3 firebase_crashlytics: ^2.0.0 + power_logger: ^1.0.1-nullsafety.1 logger: ^1.0.0 aku_ui: