Skip to content

Commit

Permalink
connected_to_firebase_database
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumyname committed Jul 10, 2020
1 parent 159e552 commit dc7cf76
Show file tree
Hide file tree
Showing 14 changed files with 427 additions and 223 deletions.
4 changes: 3 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if (flutterVersionName == null) {
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

Expand All @@ -39,7 +40,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "task.notemaker"
minSdkVersion 16
multiDexEnabled true
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
40 changes: 40 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "911031623783",
"firebase_url": "https://tasklist-47342.firebaseio.com",
"project_id": "tasklist-47342",
"storage_bucket": "tasklist-47342.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:911031623783:android:0b8c34a9fe53b6cb61b4c2",
"android_client_info": {
"package_name": "task.notemaker"
}
},
"oauth_client": [
{
"client_id": "911031623783-8skb7r6718p5nud254lphq96mf7bhjv3.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAkFcFbWwkeOHj6G55xk6-WE_Mpb_cUEQI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "911031623783-8skb7r6718p5nud254lphq96mf7bhjv3.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
4 changes: 3 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="task.notemaker">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand All @@ -8,7 +9,8 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="notemaker"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
tools:ignore="Instantiatable">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.1'
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/database/listoftasks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import 'package:notemaker/taskdetails/taskdetails.dart';
class Tlist {
String info="Not assigned";
List<Taske> tasks = [
Taske("Task1", "Many work to be done "),
Taske("Task1", "Many work to be done ","4"),
Taske("Task2",
"Yes your work has to be done \n Lets do some more work \n What you can do ?"),
Taske("Task3", "Oh Yes I did it "),
Taske("Task4", "Yet another work to be done"),
"Yes your work has to be done \n Lets do some more work \n What you can do ?","4"),
Taske("Task3", "Oh Yes I did it ","5"),
Taske("Task4", "Yet another work to be done","23"),
];

Future<void> addit(Taske t) async{
Expand Down
3 changes: 3 additions & 0 deletions lib/database/services.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:cloud_firestore/cloud_firestore.dart';

Stream<QuerySnapshot> mainstream= Firestore.instance.collection('Categories').snapshots();
41 changes: 41 additions & 0 deletions lib/firebase_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:notemaker/database/services.dart';
import 'package:notemaker/firebase_test.dart';

class Firebase extends StatefulWidget {
@override
_FirebaseState createState() => _FirebaseState();
}

class _FirebaseState extends State<Firebase> {
//List<String> fru= ['Apple','Orange','mango'];

@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: Firestore.instance.collection('Mai').snapshots(),
builder: (context, snapshot){
if(!snapshot.hasData) return Text('Nothing');
print('has data');
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index){
DocumentSnapshot ds= snapshot.data.documents[index];
var want= Firestore.instance.collection('Mai').document(ds.documentID).collection('Task').snapshots();
print(want);
return Column(
children: <Widget>[
Text(
'efs'//want['head'],
),
//Text(want['description']),
// Text(ds['']['description']),
],
);
},
);
},
);
}
}
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:notemaker/firebase_test.dart';
import 'package:notemaker/screens/category.dart';


void main() {
runApp(MaterialApp(
home: Category())
Expand Down
Loading

0 comments on commit dc7cf76

Please sign in to comment.