Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

![Screenshot (73)](https://user-images.githubusercontent.com/91218301/136259910-aa45e293-cee2-417a-84de-a693088fa6f5.png)
![Screenshot (74)](https://user-images.githubusercontent.com/91218301/136259918-878a0b5d-3d71-44dd-879e-630382c6a3df.png)
30 changes: 30 additions & 0 deletions Task2/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}
12 changes: 12 additions & 0 deletions Task2/loading.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

class Loading extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
}
36 changes: 36 additions & 0 deletions Task2/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@


import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:todo/loading.dart';
import 'package:todo/todo_list.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Firebase.initializeApp(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Scaffold(
body: Center(child: Text(snapshot.error.toString())),
);
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Loading();
}
return MaterialApp(
debugShowCheckedModeBanner: false,
home: TodoList(),
theme: ThemeData(
scaffoldBackgroundColor: Colors.grey[900],
primarySwatch: Colors.pink,
),
);
},
);
}
}
7 changes: 7 additions & 0 deletions Task2/model/todo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Todo {
String uid;
String title;
bool isComplet;

Todo({required this.uid, required this.title, required this.isComplet});
}
41 changes: 41 additions & 0 deletions Task2/services/database_services.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:todo/model/todo.dart';

class DatabaseService {
CollectionReference todosCollection =
FirebaseFirestore.instance.collection("Todos");

Future createNewTodo(String title) async {
return await todosCollection.add({
"title": title,
"isComplet": false,
});
}

Future completTask(uid) async {
await todosCollection.doc(uid).update({"isComplet": true});
}

Future removeTodo(uid) async {
await todosCollection.doc(uid).delete();
}

List<Todo> todoFromFirestore(QuerySnapshot snapshot) {
if (snapshot != null) {
return snapshot.docs.map((e) {
return Todo(
isComplet: e.data()["isComplet"],
title: e.data()["title"],
uid: e.id,
);
}).toList();
} else {
return null;
}
}

Stream<List<Todo>> listTodos() {
return todosCollection.snapshots().map(todoFromFirestore);
}
}
29 changes: 29 additions & 0 deletions Task2/todo_android.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/app/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/app/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/app/src/main/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/app/src/main/libs" />
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/app/src/main/proguard_logs" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/app/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Flutter for Android" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
1 change: 1 addition & 0 deletions Task2\
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions assets/images/account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/account_active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions assets/images/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions assets/images/add_active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/images/camera.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/heart_active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/heart_red.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/home_active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading