其他语言:英语
该项目旨在成为基本模板或起动器,以迅速启动扑朔迷离的项目。
博彩由两个屏幕组成:登录和家庭
在此屏幕上,用户可以:
我们一旦确定的屏幕就可以到达,这使我们能够完成会话。
该应用程序还会在数据库中创建一个名为“活动”的文档,其中每次登录时都会保存用户时间和ID。
该项目的目的是证明使用Flutter与Firebase的使用,以快速创建一个具有后端的应用程序,以管理用户和身份验证以及数据库存储信息。
在开发团队中安装颤动:
https://flutter.dev/docs/get-started/install/macos
确保我们安装了Android Studio和Xcode:
XCode下载
Android Studio下载(用于Mac)
安装后,请检查以下安装:
flutter doctor
git clone [email protected]:ramoncardena/flutter-firebase-starter.git flutter-firebase-starter
cd flutter-firebase-starter
flutter packages get
我们在Xcode中打开iOS项目: ~/flutter-firebase-starter/ios
在项目的结构中,我们选择了根runner ,在“身份”部分中的一般部分中,我们定义了捆绑包ID(捆绑识别器)和版本(版本)。
然后,我们转到签名和功能部分,在签署部分,我们选择了适当的设备(团队)来签署项目。
让我们转到为应用程序定义毕业~/flutter-firebase-starter/android/app/build.gradle项目文件夹:
然后,我们使用应用程序ID( applicationID )修改了DefaultConfig部分,并将SDK( Minsdkversion )的最小版本设置为21
defaultConfig {
applicationId "com.ramoncardena.firebasestarter"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
在本文中,我们将以英语找到详细信息。
我们去了火箱控制台。
我们创建一个新项目,一旦创建,添加两个应用程序,一个Android和另一个iOS。
我们从Firebase控制台创建一个新的iOS应用程序,并填写基本数据。
然后,我们下载googleservice-info.plist配置文件。
重要的是:我们打开XCode,并在Runner/Runner文件夹上使用右键,添加Firebase配置文件和封闭的Xcode。
此外,要使用Google登录的身份验证,我们必须将相应的密钥添加到ios/Runner/Info.plist文件:
<!-- Google Sign-in Section -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<!-- TODO Replace this value: -->
<!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID -->
<string>com.googleusercontent.apps.861823949799-vcuujjn0vvnmcvjppkn</string>
</array>
</dict>
</array>
<!-- End of the Google Sign-in Section -->
我们使用Firebase控制台创建一个新的Android应用程序,并使用基本数据创建。
要添加SHA签名密钥,从终端我们转到项目文件夹并执行:
keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
(作为密码,我们使用android )
从这一部分中,它已经在项目中实施,只有信息丰富
然后我们下载Google-Services文件。设置并将其复制到项目文件夹中: android/app 。
复制文件后,我们必须配置毕业以与Firebase一起使用。我们首先编辑android/build.gradle :
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
// ...
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
在android/app/build.gradle上:
dependencies {
// ...
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
最后,我们编辑android/gradle.properties文件并添加:
android.useAndroidX=true
android.enableJetifier=true
最后我们执行:
flutter packages get
修改ID后,我们验证新安装的应用程序是否在两个系统中执行(我们连接Android Mobile和iPhone:
flutter packages get
flutter run -d all
(或从Android Studio启动项目)
该部分已经在项目中实施,只有内容丰富
我们在pubspec.yaml项部分中添加了我们需要firebase的插件:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
## AQUÍ DEPENDENCIAS FIREBASE Y OTRAS...
firebase_core: ^0.4.1+5
firebase_analytics: ^5.0.6
cloud_firestore: ^0.12.10
firebase_auth: ^0.14.0+9
google_sign_in: ^4.0.14
rxdart: ^0.22.6
provider: 2.0.0+1
font_awesome_flutter: 8.4.0
定义插件后,我们将安装它们:
flutter packages get
我们执行该应用程序以查看一切有效:
flutter run -d all
您可以在我的网站上了解有关我的更多信息,或在博客上阅读我的文章