启用 fire base 并初始化

hmxc
张萌 4 years ago
parent b28cac1438
commit 9f8cf92e70

@ -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/dev_util.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -44,6 +45,8 @@ class _SplashPageState extends State<SplashPage> {
await Permission.locationWhenInUse.request(); await Permission.locationWhenInUse.request();
} }
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
Future _initOp() async { Future _initOp() async {
await _originOp(); await _originOp();
final appProvider = Provider.of<AppProvider>(context, listen: false); final appProvider = Provider.of<AppProvider>(context, listen: false);
@ -65,8 +68,13 @@ class _SplashPageState extends State<SplashPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Center( body: FutureBuilder(
child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP), future: _initialization,
builder: (context, snapshot) {
return Center(
child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP),
);
},
), ),
); );
} }

@ -56,6 +56,7 @@ dependencies:
#谷歌崩溃分析 #谷歌崩溃分析
firebase_core: ^1.0.3 firebase_core: ^1.0.3
firebase_crashlytics: ^2.0.0 firebase_crashlytics: ^2.0.0
power_logger: ^1.0.1-nullsafety.1 power_logger: ^1.0.1-nullsafety.1
logger: ^1.0.0 logger: ^1.0.0
aku_ui: aku_ui:

Loading…
Cancel
Save