In this article, we are going to set up the TYT App’s initial setup for real-time use cases.
flutter version for this project is 'Channel stable, 3.22.3'
Open your project File the Visual Studio Code which is used to create the project and also it is very powerful.
and in terminal run command 'flutter pub get'
project structure is given in image below
Change the BASE_URL Variable Presented in the Constants File.
It just updates your server’s primary URL to access all types of API Services From the App to your Server.
like this
String url = 'your base url here';
Change App Color.
just update the below parameter to change the app color
Note : File Location : project/lib/styles/styles.dart
Color buttonColor = const Color(0xffFCB13D);
Color loaderColor = const Color(0xffFCB13D);
Color theme = const Color(0xffFCB13D);
change website url in given files,
onTap: () {
openBrowser(
'your terms and condition url here');
},
child: Text(
languages[choosenLanguage]['text_terms'],
style: GoogleFonts.roboto(
fontSize: media.width * sixteen,
color: buttonColor),
),
onTap: () {
openBrowser(
'your privacy policy url here');
},
child: Text(
languages[choosenLanguage]['text_privacy'],
style: GoogleFonts.roboto(
fontSize: media.width * sixteen,
color: buttonColor),
),
SubMenu(
onTap: () {
openBrowser('privacy policy url');
},
Create & configure account for map using Google map & Cloud by following below documents.
Google Cloud console link: https://developers.google.com/maps/documentation/android-sdk/cloud-setup
firebase setup doc: https://firebase.google.com/docs/android/setup
After created & enabled the billing from google cloud & map console
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="your maps api key here"/>
String mapkey = Platform.isAndroid ? 'android map key' : 'ios map key';
We need to create nodes in firebase realtime database, please find the sample json database below or refer firebase setup.
call_FB_OTP node is used to configure whether the firebase otp should used or dummy otp should use for our testing purpose
Please make sure you have created the nodes mentioned below
Update the rules part with below content
{
"rules": {
"drivers": {
".read": true,
".write":true,
".indexOn":["is_active","g","service_location_id","vehicle_type","l","ownerid"],
},
"requests": {
".read": true,
".write": true,
".indexOn":["service_location_id"],
},
"SOS": {
".read": true,
".write": true
},
"call_FB_OTP": {
".read": true,
".write": true
},
"driver_android_version": {
".read": true,
".write": true
},
"driver_ios_version": {
".read": true,
".write": true
},
"user_android_version": {
".read": true,
".write": true
},
"user_ios_version": {
".read": true,
".write": true
},
"user_package_name": {
".read": true,
".write": true
},
"user_bundle_id": {
".read": true,
".write": true
},
"driver_package_name": {
".read": true,
".write": true
},
"driver_bundle_id": {
".read": true,
".write": true
},
"request-meta": {
".read": true,
".write": true,
".indexOn":["driver_id","user_id"]
},
"bid-meta": {
".read": true,
".write": true,
".indexOn":["driver_id","user_id","g"]
},
"owners": {
".read": true,
".write": true,
".indexOn":["driver_id","user_id"]
},
"chats": {
".read": true,
".write": true
},
}
}
applicationId "package name here"
namespace "package name here"
Note : File Location "project/android/app/src/main/kotlin/../../../MainActivity.kt"
package com.project.name
if your package name is com.package.android then,
project/android/app/src/main/kotlin/com/something/something/ to project/android/app/src/main/kotlin/com/package/android
replace icons images in following folders in given name
project/assets/images/ - logo.png
project/assets/images/ - icon.png (circle image 500x500, only for driver)
project/android/app/src/main/res/mipmap-hdpi - ic_launcher.png (72x72)
project/android/app/src/main/res/mipmap-mdpi - ic_launcher.png (48x48)
project/android/app/src/main/res/mipmap-xhdpi - ic_launcher.png (96x96)
project/android/app/src/main/res/mipmap-xxhdpi - ic_launcher.png (144x144)
project/android/app/src/main/res/mipmap-xxxhdpi - ic_launcher.png (192x192)
project/android/app/src/main/res/drawable/ - logo.png
Note : File Location "project/android/app/src/main/AndroidManifest.xml"
android:label="product name"
project/lib/main.dart
title: 'product name',
product name will continue
replaceAll('5555', 'Product Name')
Note : File Location "project/pubsec.yaml"
version: 1.0.2+3
note: change anyname with any specific name you like,
Note : File Location "project/android/key.properties as given below"
storePassword=password you entered while creating jks file
keyPassword=password you entered while creating jks file
keyAlias=alias name you given in the command for creating jks file
storeFile=jks file name with the location like ../../../jks
Generate SHA-1 and SHA-256 keys from the project
you will be able to get these keys in two ways these are
in terminal go to folder 'project/android/' and run the command './gradlew signinReport' then you will get debug and release SHA-1 and SHA-256
Run the below command in the terminal to get SHA keys
Finally copy that debug and release keys and paste those in Firebase where
Click Settings icon (presented right on project overview ) -> project settings -> Your App section -> SHA certificate fingerprints click add button and paste & Submit.
Enable below services in cloud console
Places API - which helps to get address while typing keys from the app
Maps SDK For Android
Google Sheets API - For translation sheets
Android Device Verification - For Identify the App name to append in OTP from Firebase
Geolocation APIs like distance matrix, geocoding, geolocations, Maps JavaScript, Maps static.
Click Settings icon (presented right on project overview ) -> project settings -> Your App section -> SHA certificate fingerprints click add button and paste & Submit.